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


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53281

--- Comment #1 from Rui Maciel <rui.maciel at gmail dot com> 2012-05-08 13:27:24 UTC ---
The same suggestion applies to the cases where a non-const method is called
from a const method, such as in the example below:

<code>
class Foo {
        void bar1() {}
        void bar2() const {
                bar1();
        }
};

int main()
{
        return 0;
}
</code>

The same error message is returned:
<message>
main.c++: In member function âvoid Foo::bar2() constâ:
main.c++:4:22: error: passing âconst Fooâ as âthisâ argument of âvoid
Foo::bar1()â discards qualifiers [-fpermissive]
</message>


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