[Bug c++/85087] call to a non-const member function on a const lvalue accepted
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Mar 27 00:17:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85087
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |accepts-invalid
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
The code has been accepted since at least GCC 4 so it's not a regression.
For reference, EDG eccp 4.13 prints the following errors:
"u.C", line 11: error: qualifiers dropped in binding reference of type "A &" to
initializer of type "const A"
g ((A)b); // error: good
^
"u.C", line 13: error: the object has type qualifiers that are not compatible
with the member function "A::f"
object type is: const A
((A)b).f (); // accepted: bug
^
2 errors detected in the compilation of "u.C".
More information about the Gcc-bugs
mailing list