Tag references shouldn't ever get template parameter lists.

Fixes rdar://problem/8568507



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116843 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
John McCall 2010-10-19 18:40:57 +00:00
parent af8fa25c0d
commit a25c4080a4
2 changed files with 13 additions and 4 deletions

View 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

View 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);
}