re PR c++/35734 (ICE with copy constructor in derived class)
authorJason Merrill <jason@redhat.com>
Mon, 7 Apr 2008 20:50:21 +0000 (16:50 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 7 Apr 2008 20:50:21 +0000 (16:50 -0400)
        PR c++/35734
        * class.c (type_has_user_nondefault_constructor): A template
        counts as a nondefault constructor.

From-SVN: r133987

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/ctor1.C [new file with mode: 0644]

index 6702af2..ee51b00 100644 (file)
@@ -1,3 +1,9 @@
+2008-04-07  Jason Merrill  <jason@redhat.com>
+
+       PR c++/35734
+       * class.c (type_has_user_nondefault_constructor): A template 
+       counts as a nondefault constructor.
+
 2008-04-04  Paolo Bonzini  <bonzini@gnu.org>
 
        * decl.c (cxx_push_function_context): Delete.
index 69acf11..a6dbc13 100644 (file)
@@ -4060,7 +4060,9 @@ type_has_user_nondefault_constructor (tree t)
     {
       tree fn = OVL_CURRENT (fns);
       if (!DECL_ARTIFICIAL (fn)
-         && skip_artificial_parms_for (fn, DECL_ARGUMENTS (fn)) != NULL_TREE)
+         && (TREE_CODE (fn) == TEMPLATE_DECL
+             || (skip_artificial_parms_for (fn, DECL_ARGUMENTS (fn))
+                 != NULL_TREE)))
        return true;
     }
 
index a71cae2..6fc0cc1 100644 (file)
@@ -1,3 +1,8 @@
+2008-04-07  Jason Merrill  <jason@redhat.com>
+
+       PR c++/35734
+       * g++.dg/warn/ctor1.C: New.
+
 2008-04-07  Kai Tietz  <kai.tietz@onevision.com>
 
        PR/35842
diff --git a/gcc/testsuite/g++.dg/warn/ctor1.C b/gcc/testsuite/g++.dg/warn/ctor1.C
new file mode 100644 (file)
index 0000000..00a6c95
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/35734
+// { dg-options "-W" }
+
+struct A
+{
+  A();
+  template<typename T> A(const T&);
+};
+
+struct B : A
+{
+  B(const B&) {}               // { dg-warning "base class" }
+};