diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-02-09 23:12:15 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-02-09 23:12:15 +0100 |
commit | 9bfc55d096925e7882fde2e08f557a77fd1abf77 (patch) | |
tree | d8b6501e5322eabecd24d70abffc6bbe501232e6 /gcc | |
parent | a56c0ac08242269bbcc4bd1f480eda2378336776 (diff) | |
download | gcc-9bfc55d096925e7882fde2e08f557a77fd1abf77.zip gcc-9bfc55d096925e7882fde2e08f557a77fd1abf77.tar.gz gcc-9bfc55d096925e7882fde2e08f557a77fd1abf77.tar.bz2 |
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 <jason@redhat.com>
From-SVN: r245315
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/pt.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1z/pr79143.C | 28 |
4 files changed, 42 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index caa1df9..f615f90 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2017-02-09 Jakub Jelinek <jakub@redhat.com> + Jason Merrill <jason@redhat.com> + + PR c++/79143 + * pt.c (instantiate_class_template_1): Copy CLASSTYPE_NON_AGGREGATE + from pattern to type. + 2017-02-09 Jason Merrill <jason@redhat.com> PR c++/79316 - default argument in deduction guide diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 58d6016..0a4510c 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 5997806..1030f17 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-02-09 Jakub Jelinek <jakub@redhat.com> + Jason Merrill <jason@redhat.com> + + PR c++/79143 + * g++.dg/cpp1z/pr79143.C: New test. + 2017-02-09 Jan Hubicka <hubicka@ucw.cz> * 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 0000000..baeaa48 --- /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<class> +struct derived : base { + using base::base; +}; + +template<class> +struct derived2 : base { + derived2 (int x, int y) : base (x, y) {} +}; + +int +main () +{ + base (13, 42); + derived<int> (13, 42); + derived2<int> (13, 42); + base{13, 42}; + derived<int>{13, 42}; // { dg-bogus "too many initializers" } + derived2<int>{13, 42}; +} |