Backport PR c++/83227 - C++17 ICE with init-list derived-to-base conversion.
This commit is contained in:
parent
6bc3138614
commit
a439fc7d4e
81
PR-c-83227-C-17-ICE-with-init-list-derived.patch
Normal file
81
PR-c-83227-C-17-ICE-with-init-list-derived.patch
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
From ac9de5374b4e2f4aa45c0e4f720a9727b44ab534 Mon Sep 17 00:00:00 2001
|
||||||
|
From: LiYanCheng <412998149@qq.com>
|
||||||
|
Date: Sat, 20 Nov 2021 15:50:38 +0800
|
||||||
|
Subject: [PATCH] Backport PR c++/83227 - C++17 ICE with init-list
|
||||||
|
derived-to-base conversion.
|
||||||
|
|
||||||
|
---
|
||||||
|
gcc/cp/ChangeLog | 6 ++++++
|
||||||
|
gcc/cp/call.c | 9 +++++----
|
||||||
|
gcc/testsuite/g++.dg/cpp0x/initlist98.C | 17 +++++++++++++++++
|
||||||
|
3 files changed, 28 insertions(+), 4 deletions(-)
|
||||||
|
create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist98.C
|
||||||
|
|
||||||
|
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
|
||||||
|
index b5d15c7b6..6aa0075b5 100644
|
||||||
|
--- a/gcc/cp/ChangeLog
|
||||||
|
+++ b/gcc/cp/ChangeLog
|
||||||
|
@@ -1,3 +1,9 @@
|
||||||
|
+2018-02-15 Jason Merrill <jason@redhat.com>
|
||||||
|
+
|
||||||
|
+ PR c++/83227 - C++17 ICE with init-list derived-to-base conversion.
|
||||||
|
+ * call.c (convert_like_real): Don't use the copy-list-initialization
|
||||||
|
+ shortcut for ck_base.
|
||||||
|
+
|
||||||
|
2018-01-25 Release Manager
|
||||||
|
|
||||||
|
* GCC 7.3.0 released.
|
||||||
|
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
|
||||||
|
index 56f6b9323..0993c2acf 100644
|
||||||
|
--- a/gcc/cp/call.c
|
||||||
|
+++ b/gcc/cp/call.c
|
||||||
|
@@ -6886,6 +6886,11 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
|
||||||
|
&& DECL_INHERITED_CTOR (current_function_decl))
|
||||||
|
return expr;
|
||||||
|
|
||||||
|
+ if (TREE_CODE (expr) == TARGET_EXPR
|
||||||
|
+ && TARGET_EXPR_LIST_INIT_P (expr))
|
||||||
|
+ /* Copy-list-initialization doesn't actually involve a copy. */
|
||||||
|
+ return expr;
|
||||||
|
+
|
||||||
|
/* Fall through. */
|
||||||
|
case ck_base:
|
||||||
|
if (convs->kind == ck_base && !convs->need_temporary_p)
|
||||||
|
@@ -6911,10 +6916,6 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
|
||||||
|
flags |= LOOKUP_ONLYCONVERTING;
|
||||||
|
if (convs->rvaluedness_matches_p)
|
||||||
|
flags |= LOOKUP_PREFER_RVALUE;
|
||||||
|
- if (TREE_CODE (expr) == TARGET_EXPR
|
||||||
|
- && TARGET_EXPR_LIST_INIT_P (expr))
|
||||||
|
- /* Copy-list-initialization doesn't actually involve a copy. */
|
||||||
|
- return expr;
|
||||||
|
expr = build_temp (expr, totype, flags, &diag_kind, complain);
|
||||||
|
if (diag_kind && complain)
|
||||||
|
{
|
||||||
|
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist98.C b/gcc/testsuite/g++.dg/cpp0x/initlist98.C
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000..4f2fcd202
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist98.C
|
||||||
|
@@ -0,0 +1,17 @@
|
||||||
|
+// PR c++/83227
|
||||||
|
+// { dg-do compile { target c++11 } }
|
||||||
|
+
|
||||||
|
+#include <initializer_list>
|
||||||
|
+
|
||||||
|
+template <typename d> struct f {
|
||||||
|
+ f(std::initializer_list<d>) {}
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct h {};
|
||||||
|
+struct i : h {
|
||||||
|
+ i();
|
||||||
|
+};
|
||||||
|
+void foo(f<h>);
|
||||||
|
+int main() {
|
||||||
|
+ foo({i{}});
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
|
|
||||||
10
gcc.spec
10
gcc.spec
@ -1,4 +1,4 @@
|
|||||||
%global DATE 20210628
|
%global DATE 20211123
|
||||||
%define debug_package %{nil}
|
%define debug_package %{nil}
|
||||||
|
|
||||||
%global gcc_version 7.3.0
|
%global gcc_version 7.3.0
|
||||||
@ -37,7 +37,7 @@
|
|||||||
Summary: Various compilers (C, C++, Objective-C, Java, ...)
|
Summary: Various compilers (C, C++, Objective-C, Java, ...)
|
||||||
Name: gcc
|
Name: gcc
|
||||||
Version: 7.3.0
|
Version: 7.3.0
|
||||||
Release: %{DATE}.42
|
Release: %{DATE}.43
|
||||||
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
|
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
|
||||||
Group: Development/Languages
|
Group: Development/Languages
|
||||||
#Source0: hcc-aarch64-linux-release.tar.bz2
|
#Source0: hcc-aarch64-linux-release.tar.bz2
|
||||||
@ -90,6 +90,7 @@ Patch37: Add-full-steady_clock-support-to-condition_variable.patch
|
|||||||
Patch38: fix-pre-improve-fake-exit-edge-placement.patch
|
Patch38: fix-pre-improve-fake-exit-edge-placement.patch
|
||||||
Patch39: fix-PR83666-punt-BLKmode-when-expand_debug_expr.patch
|
Patch39: fix-PR83666-punt-BLKmode-when-expand_debug_expr.patch
|
||||||
Patch40: fix-AArch64-128-bit-immediate-ICEs.patch
|
Patch40: fix-AArch64-128-bit-immediate-ICEs.patch
|
||||||
|
Patch41: PR-c-83227-C-17-ICE-with-init-list-derived.patch
|
||||||
|
|
||||||
#AutoReqProv: off
|
#AutoReqProv: off
|
||||||
AutoReq: true
|
AutoReq: true
|
||||||
@ -554,6 +555,7 @@ package or when debugging this package.
|
|||||||
%patch38 -p1
|
%patch38 -p1
|
||||||
%patch39 -p1
|
%patch39 -p1
|
||||||
%patch40 -p1
|
%patch40 -p1
|
||||||
|
%patch41 -p1
|
||||||
|
|
||||||
%if 0%{?_enable_debug_packages}
|
%if 0%{?_enable_debug_packages}
|
||||||
cat > split-debuginfo.sh <<\EOF
|
cat > split-debuginfo.sh <<\EOF
|
||||||
@ -3294,6 +3296,10 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Nov 23 2021 liyancheng <412998149@qq.com> - 7.3.0-20211123.43
|
||||||
|
- PR-c-83227-C-17-ICE-with-init-list-derived.patch: New file
|
||||||
|
- gcc.spec: Add new patch
|
||||||
|
|
||||||
* Tue Jul 27 2021 yuanxin <yuanxin24@huawei.com> - 7.3.0-20210628.42
|
* Tue Jul 27 2021 yuanxin <yuanxin24@huawei.com> - 7.3.0-20210628.42
|
||||||
- Type:bugfix
|
- Type:bugfix
|
||||||
- ID:NA
|
- ID:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user