PR c++/78198 - inherited template ctor with default arg
authorJason Merrill <jason@redhat.com>
Fri, 4 Nov 2016 12:47:01 +0000 (08:47 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 4 Nov 2016 12:47:01 +0000 (08:47 -0400)
* call.c (convert_default_arg): Look through inheriting ctors.

From-SVN: r241843

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/g++.dg/cpp0x/inh-ctor22.C [new file with mode: 0644]

index d20453bb7cec36ad7d306d5b5833fce6b48f14b0..544de43479f3455e92eea2036be67f1c0d2e1c97 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-03  Jason Merrill  <jason@redhat.com>
+
+       PR c++/78198
+       * call.c (convert_default_arg): Look through inheriting ctors.
+
 2016-11-03  Jakub Jelinek  <jakub@redhat.com>
            Alexandre Oliva  <aoliva@redhat.com>
            Jason Merrill  <jason@redhat.com>
index 27aa7fdd74b36d1482f4a9aea4aea114490063cf..d2e99bccf5ab4ba573b289010d1801ece8f813fd 100644 (file)
@@ -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 (file)
index 0000000..1b0e242
--- /dev/null
@@ -0,0 +1,16 @@
+// { dg-do compile { target c++11 } }
+
+class A { };
+template<typename> using UniquePtr = int;
+template<typename AllocPolicy> struct BufferList {
+  BufferList(unsigned, unsigned, unsigned, AllocPolicy = AllocPolicy());
+};
+class D : BufferList<A> {
+  using BufferList::BufferList;
+};
+template<typename , typename... Args> UniquePtr<D> MakeUnique(Args... aArgs)
+{
+  D d(aArgs...);
+  return 0;
+}
+UniquePtr<D> setCloneBuffer_impl_buf = MakeUnique<D>(0, 0, 0);