https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53281
Barry Revzin <barry.revzin at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |barry.revzin at gmail dot com
--- Comment #14 from Barry Revzin <barry.revzin at gmail dot com> ---
Following up on this (and a lot of the ideas presented here are I think better
than "passing [...] discards qualifiers")...
This:
struct B {
void f();
};
struct D : B {
void const_f() const {
f();
}
};
gives me that same error:
<source>:8:10: error: passing 'const D' as 'this' argument discards qualifiers
[-fpermissive]
8 | f();
| ~^~
<source>:2:10: note: in call to 'void B::f()'
2 | void f();
| ^
But this slight difference (D is now a template, though B is a non-dependent
base):
struct B {
void f();
};
template <class T>
struct D : B {
void const_f() const {
f();
}
};
instead emits:
<source>:8:10: error: cannot convert 'const D<T>*' to 'B*'
8 | f();
| ~^~
<source>:2:10: note: initializing argument 'this' of 'void B::f()'
2 | void f();
| ^
Which is... technically correct, that is the problem, but now that I'm used to
seeing the "discards qualifiers" error, this one really threw me for a loop.
It'd be nice at the very least if these two examples gave the same error