This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/85087] call to a non-const member function on a const lvalue accepted


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".

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]