This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/51048] Class template inheritance doesn't work well with function-local types
- From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 09 Nov 2011 12:23:54 +0000
- Subject: [Bug c++/51048] Class template inheritance doesn't work well with function-local types
- Auto-submitted: auto-generated
- References: <bug-51048-4@http.gcc.gnu.org/bugzilla/>
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).