diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e62aefde0c70..b60b1ecc6046 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2020-03-10 Jason Merrill + + PR c++/93956 + * pt.c (maybe_aggr_guide): Check BRACE_ENCLOSED_INITIALIZER_P. + 2020-03-10 Jason Merrill PR c++/93922 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 49ee3920049e..179716b56800 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -28182,7 +28182,7 @@ maybe_aggr_guide (tree tmpl, tree init, vec *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 000000000000..f14bdf0b8ec8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction70.C @@ -0,0 +1,7 @@ +// PR c++/93596 + +template struct A {}; +template struct B {}; +template struct C { + void foo () { B a = A { foo }; } // { dg-error "" } +};