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 6702af2a6c748d6f56463398d1efd2cbb46ca495..ee51b005fee1c42b72508a98752b970db49e88cc 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 69acf11cdfc80630296e5f0822893c5044d00546..a6dbc13a9b36789c79e153b015d1a5058c7d26da 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 a71cae2d0a3b05c84997b9dd4c89c85248b91db3..6fc0cc1f98ba15196ccde4a7ceb0948fb99a5fe0 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" }
+};