+2003-08-21 Jason Merrill <jason@redhat.com>
+
+ PR c++/11283
+ * call.c (build_conditional_expr): Ignore cv-qual differences for
+ non-class types.
+
2003-08-21 Mark Mitchell <mark@codesourcery.com>
PR c++/11551
{
arg2 = convert_like (conv2, arg2);
arg2 = convert_from_reference (arg2);
- if (!same_type_p (TREE_TYPE (arg2), arg3_type))
+ if (!same_type_p (TREE_TYPE (arg2), arg3_type)
+ && CLASS_TYPE_P (arg3_type))
+ /* The types need to match if we're converting to a class type.
+ If not, we don't care about cv-qual mismatches, since
+ non-class rvalues are not cv-qualified. */
abort ();
arg2_type = TREE_TYPE (arg2);
}
{
arg3 = convert_like (conv3, arg3);
arg3 = convert_from_reference (arg3);
- if (!same_type_p (TREE_TYPE (arg3), arg2_type))
+ if (!same_type_p (TREE_TYPE (arg3), arg2_type)
+ && CLASS_TYPE_P (arg2_type))
abort ();
arg3_type = TREE_TYPE (arg3);
}
--- /dev/null
+// PR c++/11283
+// Converting "a" to the type of "i" produces "int" rather than "const
+// int", which was causing build_conditional_expr to abort. But we don't
+// care about cv-quals on non-class rvalues.
+
+struct A
+{
+ operator int ();
+};
+
+extern A a;
+extern const int i;
+extern bool b;
+
+int f ()
+{
+ return b ? a : i;
+}