From: Jason Merrill Date: Mon, 7 Apr 2008 20:50:21 +0000 (-0400) Subject: re PR c++/35734 (ICE with copy constructor in derived class) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c2b58ba219a15e6ecac98559942d72433d0574ae;p=gcc.git re PR c++/35734 (ICE with copy constructor in derived class) PR c++/35734 * class.c (type_has_user_nondefault_constructor): A template counts as a nondefault constructor. From-SVN: r133987 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6702af2a6c7..ee51b005fee 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2008-04-07 Jason Merrill + + PR c++/35734 + * class.c (type_has_user_nondefault_constructor): A template + counts as a nondefault constructor. + 2008-04-04 Paolo Bonzini * decl.c (cxx_push_function_context): Delete. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 69acf11cdfc..a6dbc13a9b3 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -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; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a71cae2d0a3..6fc0cc1f98b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-04-07 Jason Merrill + + PR c++/35734 + * g++.dg/warn/ctor1.C: New. + 2008-04-07 Kai Tietz PR/35842 diff --git a/gcc/testsuite/g++.dg/warn/ctor1.C b/gcc/testsuite/g++.dg/warn/ctor1.C new file mode 100644 index 00000000000..00a6c952b64 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/ctor1.C @@ -0,0 +1,13 @@ +// PR c++/35734 +// { dg-options "-W" } + +struct A +{ + A(); + template A(const T&); +}; + +struct B : A +{ + B(const B&) {} // { dg-warning "base class" } +};