This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH for c++/38649
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 11 Feb 2009 00:15:37 -0500
- Subject: C++ PATCH for c++/38649
defaultable_fn_p wasn't being strict enough in checking whether or not a
function is suitable for defaulting.
Tested x86_64-pc-linux-gnu, applied to trunk.
2009-02-10 Jason Merrill <jason@redhat.com>
PR c++/38649
* class.c (defaultable_fn_p): Handle ... properly.
Index: cp/class.c
===================================================================
*** cp/class.c (revision 144035)
--- cp/class.c (working copy)
*************** defaultable_fn_p (tree fn)
*** 4138,4147 ****
{
if (DECL_CONSTRUCTOR_P (fn))
{
! if (skip_artificial_parms_for (fn, DECL_ARGUMENTS (fn))
! == NULL_TREE)
return true;
! else if (copy_fn_p (fn) > 0)
return true;
else
return false;
--- 4138,4148 ----
{
if (DECL_CONSTRUCTOR_P (fn))
{
! if (FUNCTION_FIRST_USER_PARMTYPE (fn) == void_list_node)
return true;
! else if (copy_fn_p (fn) > 0
! && (TREE_CHAIN (FUNCTION_FIRST_USER_PARMTYPE (fn))
! == void_list_node))
return true;
else
return false;
Index: testsuite/g++.dg/cpp0x/defaulted8.C
===================================================================
*** testsuite/g++.dg/cpp0x/defaulted8.C (revision 0)
--- testsuite/g++.dg/cpp0x/defaulted8.C (revision 0)
***************
*** 0 ****
--- 1,8 ----
+ // PR c++/38649
+ // { dg-options "-std=c++0x" }
+
+ struct A
+ {
+ A(...) = default; // { dg-error "cannot be defaulted" }
+ A(const A&, ...) = default; // { dg-error "cannot be defaulted" }
+ };