+2019-03-25 Marek Polacek <polacek@redhat.com>
+
+ PR c++/89705 - ICE with reference binding with conversion function.
+ * call.c (reference_binding): If the result of the conversion function
+ is a prvalue of non-class type, use the cv-unqualified type.
+
2019-03-25 Nathan Sidwell <nathan@acm.org>
* lambda.c (maybe_add_lambda_conv_op): Don't add to comdat group.
&& DECL_CONV_FN_P (t->cand->fn))
{
tree ftype = TREE_TYPE (TREE_TYPE (t->cand->fn));
+ /* A prvalue of non-class type is cv-unqualified. */
+ if (!TYPE_REF_P (ftype) && !CLASS_TYPE_P (ftype))
+ ftype = cv_unqualified (ftype);
int sflags = (flags|LOOKUP_NO_CONVERSION)&~LOOKUP_NO_TEMP_BIND;
conversion *new_second
= reference_binding (rto, ftype, NULL_TREE, c_cast_p,
+2019-03-25 Marek Polacek <polacek@redhat.com>
+
+ PR c++/89705 - ICE with reference binding with conversion function.
+ * g++.dg/cpp0x/rv-conv2.C: New test.
+
2019-03-25 Richard Biener <rguenther@suse.de>
PR tree-optimization/89789
--- /dev/null
+// PR c++/89705
+// { dg-do compile { target c++11 } }
+
+struct W { operator const volatile int(); };
+const int& rci = W();
+
+struct X { operator const int(); };
+int&& rri = X();
+
+struct Y { operator volatile int(); };
+int&& rri2 = Y();
+
+struct Z { operator const volatile int(); };
+volatile int&& rri3 = Z();
+
+enum E { A };
+struct S { operator const E(); };
+E&& rre = S();