From 48840b6b58d1e81994a462bf6beb773993c2154e Mon Sep 17 00:00:00 2001 From: jakub Date: Thu, 9 Feb 2017 22:12:15 +0000 Subject: [PATCH] PR c++/79143 * pt.c (instantiate_class_template_1): Copy CLASSTYPE_NON_AGGREGATE from pattern to type. * g++.dg/cpp1z/pr79143.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245315 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/pt.c | 1 + gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/cpp1z/pr79143.C | 28 ++++++++++++++++++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1z/pr79143.C 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}; +} -- 2.11.4.GIT