aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Parse/ParseDeclCXX.cpp13
-rw-r--r--test/SemaTemplate/elaborated-type-specifier.cpp4
2 files changed, 13 insertions, 4 deletions
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index ce227c6ff2..083d6ab798 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -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
diff --git a/test/SemaTemplate/elaborated-type-specifier.cpp b/test/SemaTemplate/elaborated-type-specifier.cpp
index b34660acbe..514c5f2d57 100644
--- a/test/SemaTemplate/elaborated-type-specifier.cpp
+++ b/test/SemaTemplate/elaborated-type-specifier.cpp
@@ -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);
+}