"lvalue of type %qI", totype, extype);
else if (!TYPE_REF_IS_RVALUE (ref_type) && !lvalue_p (expr)
&& !CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (ref_type)))
- error_at (loc, "cannot bind non-const lvalue reference of "
- "type %qH to an rvalue of type %qI", totype, extype);
+ {
+ conversion *next = next_conversion (convs);
+ if (next->kind == ck_std)
+ {
+ next = next_conversion (next);
+ error_at (loc, "cannot bind non-const lvalue reference of "
+ "type %qH to a value of type %qI",
+ totype, next->type);
+ }
+ else
+ error_at (loc, "cannot bind non-const lvalue reference of "
+ "type %qH to an rvalue of type %qI", totype, extype);
+ }
else if (!reference_compatible_p (TREE_TYPE (totype), extype))
{
/* If we're converting from T[] to T[N], don't talk
--- /dev/null
+// PR c++/91849
+
+struct A { operator float(); };
+
+void
+g ()
+{
+ float f = 1.f;
+ int &r = f; // { dg-error "float" }
+ int &r2 = A(); // { dg-error "float" }
+}
+
+void
+g2 ()
+{
+ int &r = 1.f; // { dg-error "float" }
+}