]> granicus.if.org Git - clang/commitdiff
Tweak my fix for PR8748, and update the incorrect PR number in the test case.
authorDouglas Gregor <dgregor@apple.com>
Fri, 4 Feb 2011 12:22:53 +0000 (12:22 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 4 Feb 2011 12:22:53 +0000 (12:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124863 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
lib/Sema/SemaTemplate.cpp
test/CXX/temp/temp.param/p9-0x.cpp

index 88c3a770c272237b1de41c3ea2d6d3e2f5375ce3..9db6814466626217859829fa67031700e6671c7a 100644 (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);
     }
index e867354273fc44e181519149944d4c656232f08e..88ba3f9a8857d8298282e1935fbd11572de6cae0 100644 (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;
index c9d5bfb0173640cf8baf8025a5ab97238ed731b7..17eca7f7e85dd4abd282edec2d6578c2c9c89aa3 100644 (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; };