From: Jason Merrill Date: Fri, 4 Nov 2016 12:47:01 +0000 (-0400) Subject: PR c++/78198 - inherited template ctor with default arg X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=866115cd8ac778b21557a13835f7942de6fca355;p=gcc.git PR c++/78198 - inherited template ctor with default arg * call.c (convert_default_arg): Look through inheriting ctors. From-SVN: r241843 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d20453bb7ce..544de43479f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2016-11-03 Jason Merrill + + PR c++/78198 + * call.c (convert_default_arg): Look through inheriting ctors. + 2016-11-03 Jakub Jelinek Alexandre Oliva Jason Merrill diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 27aa7fdd74b..d2e99bccf5a 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -7193,6 +7193,9 @@ convert_default_arg (tree type, tree arg, tree fn, int parmnum, /* See through clones. */ fn = DECL_ORIGIN (fn); + /* And inheriting ctors. */ + if (flag_new_inheriting_ctors) + fn = strip_inheriting_ctors (fn); /* Detect recursion. */ FOR_EACH_VEC_SAFE_ELT (default_arg_context, i, t) diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor22.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor22.C new file mode 100644 index 00000000000..1b0e2425cc2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor22.C @@ -0,0 +1,16 @@ +// { dg-do compile { target c++11 } } + +class A { }; +template using UniquePtr = int; +template struct BufferList { + BufferList(unsigned, unsigned, unsigned, AllocPolicy = AllocPolicy()); +}; +class D : BufferList { + using BufferList::BufferList; +}; +template UniquePtr MakeUnique(Args... aArgs) +{ + D d(aArgs...); + return 0; +} +UniquePtr setCloneBuffer_impl_buf = MakeUnique(0, 0, 0);