]> granicus.if.org Git - clang/commitdiff
Tag references shouldn't ever get template parameter lists.
authorJohn McCall <rjmccall@apple.com>
Tue, 19 Oct 2010 18:40:57 +0000 (18:40 +0000)
committerJohn McCall <rjmccall@apple.com>
Tue, 19 Oct 2010 18:40:57 +0000 (18:40 +0000)
Fixes rdar://problem/8568507

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116843 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDeclCXX.cpp
test/SemaTemplate/elaborated-type-specifier.cpp

index ce227c6ff2384decad8b06d7412080593a615b84..083d6ab798b86229eff4f5f19000ff44e677578c 100644 (file)
@@ -964,13 +964,18 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
 
     bool IsDependent = false;
 
+    // Don't pass down template parameter lists if this is just a tag
+    // reference.  For example, we don't need the template parameters here:
+    //   template <class T> class A *makeA(T t);
+    MultiTemplateParamsArg TParams;
+    if (TUK != Sema::TUK_Reference && TemplateParams)
+      TParams =
+        MultiTemplateParamsArg(&(*TemplateParams)[0], TemplateParams->size());
+
     // Declaration or definition of a class type
     TagOrTempResult = Actions.ActOnTag(getCurScope(), TagType, TUK, StartLoc,
                                        SS, Name, NameLoc, AttrList, AS,
-                                       MultiTemplateParamsArg(Actions,
-                                    TemplateParams? &(*TemplateParams)[0] : 0,
-                                    TemplateParams? TemplateParams->size() : 0),
-                                       Owned, IsDependent, false,
+                                       TParams, Owned, IsDependent, false,
                                        clang::TypeResult());
 
     // If ActOnTag said the type was dependent, try again with the
index b34660acbea0daa46bc554f87760dbdcc170f964..514c5f2d57f4aa861ad36a48d77e6284cdac30f0 100644 (file)
@@ -34,3 +34,7 @@ namespace PR6649 {
     class T::bar { int x; }; // expected-error{{nested name specifier for a declaration cannot depend on a template parameter}}
   };
 }
+
+namespace rdar8568507 {
+  template <class T> struct A *makeA(T t);
+}