[Bug c++/53281] poor error message for calling a non-const method from a const object
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Mar 6 13:56:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53281
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
FWIW Clang says:
cv.cc:4:17: error: member function 'bar1' not viable: 'this' argument has type
'const Foo', but function is not marked const
foo.bar1();
^~~
cv.cc:2:14: note: 'bar1' declared here
void bar1() {}
^
1 error generated.
And EDG says:
"cv.cc", line 4: error: the object has type qualifiers that are not compatible
with the member function
object type is: const Foo
foo.bar1();
^
1 error detected in the compilation of "cv.cc".
More information about the Gcc-bugs
mailing list