https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100635

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-05-17
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Alternatively, remove "non-const" from the ref_type and add "volatile" to the
expr type:

vol.C:3:31: error: cannot bind lvalue reference of type 'const volatile
int&' to an rvalue of volatile type 'volatile int'

I'll test this:

--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -7900,6 +7900,10 @@ convert_like_internal (conversion *convs, tree expr,
tree fn, int argnum,
                              "type %qH to a value of type %qI",
                              totype, next->type);
                  }
+               else if (CP_TYPE_CONST_P (TREE_TYPE (ref_type)))
+                 error_at (loc, "cannot bind lvalue reference of type "
+                           "%qH to an rvalue of volatile type %qI", totype,
+                           extype);
                else
                  error_at (loc, "cannot bind non-const lvalue reference of "
                            "type %qH to an rvalue of type %qI", totype,
extype);

Reply via email to