[Bug c++/51048] Class template inheritance doesn't work well with function-local types
daniel.kruegler at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Wed Nov 9 12:38:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51048
Daniel Krügler <daniel.kruegler at googlemail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |daniel.kruegler at
| |googlemail dot com
--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2011-11-09 12:23:54 UTC ---
Simplifying the test case and compiled with
-std=c++0x -Wall
//---
template<typename X>
struct A {
virtual void DoPush(X const& x) = 0; // Line 3
void Push(X const& x) { DoPush(x); }
};
template<typename X>
struct B : A<X> {
using A<X>::Push;
virtual void DoPush(X const&) { }
};
int main() {
enum S { };
B<S>().Push(S());
}
//---
"main.cpp|3|error: 'void A<X>::DoPush(const X&) [with X = main()::S]', declared
using local type 'const main()::S', is used but never defined [-fpermissive]|"
It is important that the virtual function is pure. Validated for gcc 4.7.0
20111105 (experimental).
More information about the Gcc-bugs
mailing list