From d80b2d57cf24fb80c8ecc40b32ca10fdbeae0c85 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 22 Nov 2012 00:24:47 +0000 Subject: Fix CXXRecordDecl::forallBases to not look through bases which are dependent and defined within the current instantiation, but which are not part of the current instantiation. Previously, it would look at bases which could be specialized separately from the current template. llvm-svn: 168477 --- .../test/CXX/class.derived/class.virtual/p3-0x.cpp | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'clang/test/CXX/class.derived') diff --git a/clang/test/CXX/class.derived/class.virtual/p3-0x.cpp b/clang/test/CXX/class.derived/class.virtual/p3-0x.cpp index 16f98280ed8..6a02a867318 100644 --- a/clang/test/CXX/class.derived/class.virtual/p3-0x.cpp +++ b/clang/test/CXX/class.derived/class.virtual/p3-0x.cpp @@ -100,3 +100,33 @@ namespace PR13499 { Y y; Z z; // expected-note {{in instantiation of}} } + +namespace MemberOfUnknownSpecialization { + template struct A { + struct B {}; + struct C : B { + void f() override; + }; + }; + + template<> struct A::B { + virtual void f(); + }; + // ok + A::C c1; + + template<> struct A::B { + void f(); + }; + // expected-error@-13 {{only virtual member functions can be marked 'override'}} + // expected-note@+1 {{in instantiation of}} + A::C c2; + + template<> struct A::B { + virtual void f() final; + }; + // expected-error@-20 {{declaration of 'f' overrides a 'final' function}} + // expected-note@-3 {{here}} + // expected-note@+1 {{in instantiation of}} + A::C c3; +} -- cgit v1.2.3