[Bug c++/64431] "-Wignored-qualifiers" warning gives misleading position in code
psmith at gnu dot org
gcc-bugzilla@gcc.gnu.org
Mon Oct 24 22:12:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64431
Paul Smith <psmith at gnu dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |psmith at gnu dot org
--- Comment #6 from Paul Smith <psmith at gnu dot org> ---
Still see this in GCC 6.2.0. It was even more confusing for me because in my
case the const in the return type was hidden in a typedef:
class Foo
{
typedef const char* const MyType;
...
MyType myFunction() const { ... }
};
Shows this error:
Foo.h:202:26: error: type qualifiers ignored on function return type
MyType myFunction() const
^~~~~
I was _really_ confused :).
I'm not even sure this should trigger this error... I mean, it's inside a type.
In my case I can take it out without a big problem but what if I wanted to
have the const in the type? Then I can't return that type anymore without a
warning? Maybe that's a separate bug.
More information about the Gcc-bugs
mailing list