This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/53281] poor error message for calling a non-const method from a const object
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 06 Mar 2018 13:56:29 +0000
- Subject: [Bug c++/53281] poor error message for calling a non-const method from a const object
- Auto-submitted: auto-generated
- References: <bug-53281-4@http.gcc.gnu.org/bugzilla/>
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".