* method.c (strip_inheriting_ctors): Strip template as appropriate.
From-SVN: r243864
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.
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;
}
--- /dev/null
+// 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);