https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85060
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid, wrong-code
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-03-24
Known to work| |6.4.0
Summary|Object cannot call its |[7/8 Regression] Object
|inherited member function |cannot call its inherited
|"without object" |member function "without
| |object"
Ever confirmed|0 |1
Known to fail| |7.3.0
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Confirmed:
struct CA {
int foo() { return 42; }
};
template <class T>
struct CB : CA { };
template <class T>
struct CC : CB<T> {
int bar() {
const int m = CA::foo();
return m;
}
int baz() {
const T m = CA::foo();
return m;
}
};
int main() {
CC<double> c;
__builtin_printf("%d %d\n", c.bar(), c.baz());
}
This fails to compile with gcc-7:
85060.cc: In member function 'int CC<T>::bar()':
85060.cc:11:26: error: cannot call member function 'int CA::foo()' without
object
const int m = CA::foo();
~~~~~~~^~
It compiles with gcc-8 but warns about an uninitialized variable, and prints
garbage:
1078263808 42
So rejects-valid with gcc-7-branch and wrong-code with trunk.