diff mbox

[C++] PR 50858

Message ID 4EA68CEC.30208@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Oct. 25, 2011, 10:18 a.m. UTC
Hi,

this fixes an ICE on invalid which occurs inside 
composite_pointer_type_r, now a bit more stressed post fix for PR38174. 
Tested x86_64-linux.

Ok for mainline?

Thanks,
Paolo.

//////////////////////
/cp
2011-10-25  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/50858
	* typeck.c (composite_pointer_type_r): Check return value of
	composite_pointer_type_r for error_mark_node.

/testsuite
2011-10-25  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/50858
	* g++.dg/overload/operator5.C: New.

Comments

Jason Merrill Oct. 25, 2011, 1:14 p.m. UTC | #1
OK.

Jason
diff mbox

Patch

Index: testsuite/g++.dg/overload/operator5.C
===================================================================
--- testsuite/g++.dg/overload/operator5.C	(revision 0)
+++ testsuite/g++.dg/overload/operator5.C	(revision 0)
@@ -0,0 +1,16 @@ 
+// PR c++/50858
+
+class String {
+   typedef struct ImplicitConversionFromWTFStringToBoolDisallowedA* 
+   (String::*UnspecifiedBoolTypeA);
+   typedef struct ImplicitConversionFromWTFStringToBoolDisallowedB* 
+   (String::*UnspecifiedBoolTypeB);
+   operator UnspecifiedBoolTypeA() const;
+   operator UnspecifiedBoolTypeB() const;
+};
+inline bool equalIgnoringCase(const String& a, const String& b) { }
+inline bool equalPossiblyIgnoringCase(const String& a, 
+                                      const String& b,
+                                      bool ignoreCase) {
+  return ignoreCase ? equalIgnoringCase(a, b) : (a == b); } // { dg-error "ambiguous" }
+// { dg-message "note" { target *-*-* } 15 }
Index: cp/typeck.c
===================================================================
--- cp/typeck.c	(revision 180424)
+++ cp/typeck.c	(working copy)
@@ -510,8 +510,12 @@  composite_pointer_type_r (tree t1, tree t2,
 	    && TREE_CODE (pointee2) == POINTER_TYPE)
 	   || (TYPE_PTR_TO_MEMBER_P (pointee1)
 	       && TYPE_PTR_TO_MEMBER_P (pointee2)))
-    result_type = composite_pointer_type_r (pointee1, pointee2, operation,
-					    complain);
+    {
+      result_type = composite_pointer_type_r (pointee1, pointee2, operation,
+					      complain);
+      if (result_type == error_mark_node)
+	return error_mark_node;
+    }
   else
     {
       if (complain & tf_error)