diff options
author | Jason Merrill <jason@redhat.com> | 2016-12-21 14:10:23 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2016-12-21 14:10:23 -0500 |
commit | 0bcd172dbf4f3d9168d4436e5f34730b8987762a (patch) | |
tree | cda65b7572553c9bd570bf51db6ad0581a3b6f6a /gcc | |
parent | 3a8f9451d9bd8d00ca0bb0d9ca45c54f794600e5 (diff) | |
download | gcc-0bcd172dbf4f3d9168d4436e5f34730b8987762a.zip gcc-0bcd172dbf4f3d9168d4436e5f34730b8987762a.tar.gz gcc-0bcd172dbf4f3d9168d4436e5f34730b8987762a.tar.bz2 |
PR c++/78767 - ICE with inherited constructor default argument
* method.c (strip_inheriting_ctors): Strip template as appropriate.
From-SVN: r243864
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/method.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/inh-ctor24.C | 15 |
3 files changed, 23 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c4c5171..1b14e19 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2016-12-21 Jason Merrill <jason@redhat.com> + PR c++/78767 - ICE with inherited constructor default argument + * method.c (strip_inheriting_ctors): Strip template as appropriate. + PR c++/78749 - friend in anonymous namespace * decl.c (wrapup_globals_for_namespace): Don't complain about friend pseudo-template instantiations. diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 73d42b1..a5271a4 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -496,14 +496,18 @@ forward_parm (tree parm) constructor from a (possibly indirect) base class. */ tree -strip_inheriting_ctors (tree fn) +strip_inheriting_ctors (tree dfn) { gcc_assert (flag_new_inheriting_ctors); + tree fn = dfn; while (tree inh = DECL_INHERITED_CTOR (fn)) { inh = OVL_CURRENT (inh); fn = inh; } + if (TREE_CODE (fn) == TEMPLATE_DECL + && TREE_CODE (dfn) == FUNCTION_DECL) + fn = DECL_TEMPLATE_RESULT (fn); return fn; } diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor24.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor24.C new file mode 100644 index 0000000..7c1fae0 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor24.C @@ -0,0 +1,15 @@ +// PR c++/78767 +// { dg-do compile { target c++11 } } + +template <class T> struct A +{ + template <class U> + A(U, U = 42); +}; + +struct B: A<int> +{ + using A::A; +}; + +B b(24); |