This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/51048] Class template inheritance doesn't work well with function-local types


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).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]