PR c++/78767 - ICE with inherited constructor default argument

* method.c (strip_inheriting_ctors): Strip template as appropriate.

From-SVN: r243864
This commit is contained in:
Jason Merrill 2016-12-21 14:10:23 -05:00 committed by Jason Merrill
parent 3a8f9451d9
commit 0bcd172dbf
3 changed files with 23 additions and 1 deletions

View File

@ -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.

View File

@ -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;
}

View File

@ -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);