diff options
author | hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-07-27 17:40:04 +0000 |
---|---|---|
committer | hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-07-27 17:40:04 +0000 |
commit | 101b351151f72bfa846004a32596ae6dc76e3e4c (patch) | |
tree | bf63c1aa1a17ac9a534c474ad3030bed8db34f11 /gcc/cp | |
parent | 127fb64dee19a65504cef92fcf1ed8f802540dfa (diff) | |
download | gcc-101b351151f72bfa846004a32596ae6dc76e3e4c.tar.gz |
gcc/cp/
2008-07-27 H.J. Lu <hongjiu.lu@intel.com>
PR c++/36944
* class.c (type_has_user_provided_default_constructor): Handle
default parameters.
gcc/testsuite/
2008-07-27 H.J. Lu <hongjiu.lu@intel.com>
PR c++/36944
* g++.dg/other/pr36944.C: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138194 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/class.c | 14 |
2 files changed, 15 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c40808e6fd2..6a13613d860 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 18204608da3..f7e46a717aa 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; |