This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: PR c++/36944: [4.4 Regression]: Revision 138123 breaks C++


On Sat, Jul 26, 2008 at 08:05:02AM -0700, H.J. Lu wrote:
> Hi Jason,
> 
> I think your patch caused:
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36944
> 

This patch works on the testcase.


H.J.
----
gcc/cp/

2008-07-26  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-26  H.J. Lu  <hongjiu.lu@intel.com>

	PR c++/36944
	* g++.dg/other/pr36944.C: New.

--- gcc/cp/class.c.arg	2008-07-26 11:36:31.000000000 -0700
+++ gcc/cp/class.c	2008-07-26 11:41:26.000000000 -0700
@@ -4107,7 +4107,7 @@ type_has_user_provided_constructor (tree
 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,17 @@ type_has_user_provided_default_construct
     {
       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))
+	{
+	  if (skip_artificial_parms_for (fn, DECL_ARGUMENTS (fn))
+	      == NULL_TREE)
+	    return true;
+	  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;
--- gcc/testsuite/g++.dg/other/pr36944.C.arg	2008-07-26 11:44:33.000000000 -0700
+++ gcc/testsuite/g++.dg/other/pr36944.C	2008-07-26 11:46:25.000000000 -0700
@@ -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;
+};


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]