This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/85087] call to a non-const member function on a const lvalue accepted
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 27 Mar 2018 00:17:38 +0000
- Subject: [Bug c++/85087] call to a non-const member function on a const lvalue accepted
- Auto-submitted: auto-generated
- References: <bug-85087-4@http.gcc.gnu.org/bugzilla/>
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".