From: Jakub Jelinek Date: Thu, 9 Feb 2017 22:12:15 +0000 (+0100) Subject: re PR c++/79143 ([new inheriting constructors] inheriting constructor fails with... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9bfc55d096925e7882fde2e08f557a77fd1abf77;p=gcc.git re PR c++/79143 ([new inheriting constructors] inheriting constructor fails with brace initialization) PR c++/79143 * pt.c (instantiate_class_template_1): Copy CLASSTYPE_NON_AGGREGATE from pattern to type. * g++.dg/cpp1z/pr79143.C: New test. Co-Authored-By: Jason Merrill From-SVN: r245315 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index caa1df91383..f615f908f5e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2017-02-09 Jakub Jelinek + Jason Merrill + + PR c++/79143 + * pt.c (instantiate_class_template_1): Copy CLASSTYPE_NON_AGGREGATE + from pattern to type. + 2017-02-09 Jason Merrill PR c++/79316 - default argument in deduction guide diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 58d60160e98..0a4510c8ebe 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -10253,6 +10253,7 @@ instantiate_class_template_1 (tree type) TYPE_PACKED (type) = TYPE_PACKED (pattern); SET_TYPE_ALIGN (type, TYPE_ALIGN (pattern)); TYPE_USER_ALIGN (type) = TYPE_USER_ALIGN (pattern); + CLASSTYPE_NON_AGGREGATE (type) = CLASSTYPE_NON_AGGREGATE (pattern); if (ANON_AGGR_TYPE_P (pattern)) SET_ANON_AGGR_TYPE_P (type); if (CLASSTYPE_VISIBILITY_SPECIFIED (pattern)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 599780624e4..1030f172c6d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-02-09 Jakub Jelinek + Jason Merrill + + PR c++/79143 + * g++.dg/cpp1z/pr79143.C: New test. + 2017-02-09 Jan Hubicka * gcc.dg/loop-unswitch-2.c: Update testcase. diff --git a/gcc/testsuite/g++.dg/cpp1z/pr79143.C b/gcc/testsuite/g++.dg/cpp1z/pr79143.C new file mode 100644 index 00000000000..baeaa4899f6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/pr79143.C @@ -0,0 +1,28 @@ +// PR c++/79143 +// { dg-do compile } +// { dg-options "-std=c++1z" } + +struct base { + base (int, int) {} +}; + +template +struct derived : base { + using base::base; +}; + +template +struct derived2 : base { + derived2 (int x, int y) : base (x, y) {} +}; + +int +main () +{ + base (13, 42); + derived (13, 42); + derived2 (13, 42); + base{13, 42}; + derived{13, 42}; // { dg-bogus "too many initializers" } + derived2{13, 42}; +}