[gcc/devel/c++-modules] c++: Fix ICE with omitted template args [PR93956].
Nathan Sidwell
nathan@gcc.gnu.org
Thu Mar 19 12:38:29 GMT 2020
https://gcc.gnu.org/g:df15a82804e1f7f4a7432670b33387779de46549
commit df15a82804e1f7f4a7432670b33387779de46549
Author: Jason Merrill <jason@redhat.com>
Date: Tue Mar 10 17:51:46 2020 -0400
c++: Fix ICE with omitted template args [PR93956].
reshape_init only wants to work on BRACE_ENCLOSED_INITIALIZER_P, i.e. raw
initializer lists, and here was getting a CONSTRUCTOR that had already been
processed for type A<int>. maybe_aggr_guide should also use that test.
gcc/cp/ChangeLog
2020-03-10 Jason Merrill <jason@redhat.com>
PR c++/93956
* pt.c (maybe_aggr_guide): Check BRACE_ENCLOSED_INITIALIZER_P.
Diff:
---
gcc/cp/ChangeLog | 5 +++++
gcc/cp/pt.c | 2 +-
gcc/testsuite/g++.dg/cpp1z/class-deduction70.C | 7 +++++++
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e62aefde0c7..b60b1ecc604 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2020-03-10 Jason Merrill <jason@redhat.com>
+
+ PR c++/93956
+ * pt.c (maybe_aggr_guide): Check BRACE_ENCLOSED_INITIALIZER_P.
+
2020-03-10 Jason Merrill <jason@redhat.com>
PR c++/93922
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 49ee3920049..179716b5680 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -28182,7 +28182,7 @@ maybe_aggr_guide (tree tmpl, tree init, vec<tree,va_gc> *args)
tsubst_flags_t complain = tf_none;
tree parms = NULL_TREE;
- if (TREE_CODE (init) == CONSTRUCTOR)
+ if (BRACE_ENCLOSED_INITIALIZER_P (init))
{
init = reshape_init (type, init, complain);
if (init == error_mark_node)
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction70.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction70.C
new file mode 100644
index 00000000000..f14bdf0b8ec
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction70.C
@@ -0,0 +1,7 @@
+// PR c++/93596
+
+template <typename> struct A {};
+template <typename> struct B {};
+template <typename> struct C {
+ void foo () { B a = A<int> { foo }; } // { dg-error "" }
+};
More information about the Gcc-cvs
mailing list