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++/53281] poor error message for calling a non-const method from a const object


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

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