Tweak my fix for PR8748, and update the incorrect PR number in the test case.

llvm-svn: 124863
This commit is contained in:
Douglas Gregor 2011-02-04 12:22:53 +00:00
parent 87866ceda7
commit 4d5c297607
3 changed files with 6 additions and 4 deletions

View File

@ -3972,7 +3972,8 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
? TPC_FriendFunctionTemplateDefinition
: TPC_FriendFunctionTemplate)
: (D.getCXXScopeSpec().isSet() &&
DC && DC->isRecord())
DC && DC->isRecord() &&
DC->isDependentContext())
? TPC_ClassTemplateMember
: TPC_FunctionTemplate);
}

View File

@ -947,7 +947,8 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
if (CheckTemplateParameterList(TemplateParams,
PrevClassTemplate? PrevClassTemplate->getTemplateParameters() : 0,
(SS.isSet() && SemanticContext &&
SemanticContext->isRecord())
SemanticContext->isRecord() &&
SemanticContext->isDependentContext())
? TPC_ClassTemplateMember
: TPC_ClassTemplate))
Invalid = true;

View File

@ -22,10 +22,10 @@ struct X3 {
}
};
namespace PR8747 {
namespace PR8748 {
// Testcase 1
struct A0 { template<typename U> struct B; };
template<typename U = int> struct A0::B { }; // expected-error{{cannot add a default template argument to the definition of a member of a class template}}
template<typename U = int> struct A0::B { };
// Testcase 2
template<typename T> struct A1 { template<typename U> struct B; };