diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c40808e6fd2bcfae80501af68dac608596414207..6a13613d860eaca8d7a7919b817c019c8782c886 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2008-07-27 H.J. Lu <hongjiu.lu@intel.com> + + PR c++/36944 + * class.c (type_has_user_provided_default_constructor): Handle + default parameters. + 2008-07-27 Paolo Carlini <paolo.carlini@oracle.com> * decl.c (push_library_fn): Add a parameter for the exceptions that diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 18204608da36b0dd3fafd559702119ec811f1bb5..f7e46a717aaf49e62c821ef6621a576442ec1dee 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -4107,7 +4107,7 @@ type_has_user_provided_constructor (tree t) bool type_has_user_provided_default_constructor (tree t) { - tree fns; + tree fns, args; if (!TYPE_HAS_USER_CONSTRUCTOR (t)) return false; @@ -4116,10 +4116,14 @@ type_has_user_provided_default_constructor (tree t) { tree fn = OVL_CURRENT (fns); if (TREE_CODE (fn) == FUNCTION_DECL - && user_provided_p (fn) - && (skip_artificial_parms_for (fn, DECL_ARGUMENTS (fn)) - == NULL_TREE)) - return true; + && user_provided_p (fn)) + { + args = FUNCTION_FIRST_USER_PARMTYPE (fn); + while (args && TREE_PURPOSE (args)) + args = TREE_CHAIN (args); + if (!args || args == void_list_node) + return true; + } } return false; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 95b0cde4944c2a411ca8ad8a730eb23e26ffba91..c32bc3d7d8bf7749af0830fe0b394f318b51cd56 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-07-27 H.J. Lu <hongjiu.lu@intel.com> + + PR c++/36944 + * g++.dg/other/pr36944.C: New. + 2008-07-27 Daniel Franke <franke.daniel@gmail.com> PR fortran/36724 diff --git a/gcc/testsuite/g++.dg/other/pr36944.C b/gcc/testsuite/g++.dg/other/pr36944.C new file mode 100644 index 0000000000000000000000000000000000000000..b4a1dfa46fdff202ef586733db63c380481c4c4e --- /dev/null +++ b/gcc/testsuite/g++.dg/other/pr36944.C @@ -0,0 +1,26 @@ +/* { dg-do compile } */ + +class XObject +{ +public: + int foo; +}; + +class XObjectPtr +{ +public: + explicit + XObjectPtr(XObject* theXObject = 0) : m_xobjectPtr(theXObject) + { + } + +private: + XObject * m_xobjectPtr; +}; + +class SelectionEvent +{ +public: + SelectionEvent(bool selection) : m_selection() {} + const XObjectPtr m_selection; +};