From: Douglas Gregor Date: Fri, 4 Feb 2011 12:22:53 +0000 (+0000) Subject: Tweak my fix for PR8748, and update the incorrect PR number in the test case. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=461bf2eb82981d00a014409126ef9c3538551a94;p=clang Tweak my fix for PR8748, and update the incorrect PR number in the test case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124863 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 88c3a770c2..9db6814466 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -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); } diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index e867354273..88ba3f9a88 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -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; diff --git a/test/CXX/temp/temp.param/p9-0x.cpp b/test/CXX/temp/temp.param/p9-0x.cpp index c9d5bfb017..17eca7f7e8 100644 --- a/test/CXX/temp/temp.param/p9-0x.cpp +++ b/test/CXX/temp/temp.param/p9-0x.cpp @@ -22,10 +22,10 @@ struct X3 { } }; -namespace PR8747 { +namespace PR8748 { // Testcase 1 struct A0 { template struct B; }; - template struct A0::B { }; // expected-error{{cannot add a default template argument to the definition of a member of a class template}} + template struct A0::B { }; // Testcase 2 template struct A1 { template struct B; };