When instantiating member functions, propagate whether the member function is marked 'final' and 'override'.

Also, call CheckOverrideControl when instantiating member functions.

llvm-svn: 123900
This commit is contained in:
Anders Carlsson 2011-01-20 06:52:44 +00:00
parent 2d67ed8f3b
commit 7c812f5a99
2 changed files with 20 additions and 0 deletions

View File

@ -1393,8 +1393,12 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D,
if (D->isPure())
SemaRef.CheckPureMethod(Method, SourceRange());
Method->setIsMarkedOverride(D->isMarkedOverride());
Method->setIsMarkedFinal(D->isMarkedFinal());
Method->setAccess(D->getAccess());
SemaRef.CheckOverrideControl(Method);
if (FunctionTemplate) {
// If there's a function template, let our caller handle it.
} else if (Method->isInvalidDecl() && !Previous.empty()) {

View File

@ -24,3 +24,19 @@ struct B : A {
};
}
namespace Test3 {
struct A {
virtual void f(int, char, int);
};
template<typename... Args>
struct B : A {
virtual void f(Args...) override; // expected-error {{'f' marked 'override' but does not override any member functions}}
};
template struct B<int, char, int>;
template struct B<int>; // expected-note {{in instantiation of template class 'Test3::B<int>' requested here}}
}