diff options
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r-- | gcc/cp/call.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 4b81d0f..c9a8c0d 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -7898,8 +7898,19 @@ convert_like_internal (conversion *convs, tree expr, tree fn, int argnum, "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 |