diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-10-21 17:26:49 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-10-21 17:26:49 +0000 |
commit | a02bb37a8c372f6059c072919a1dd103988ca81d (patch) | |
tree | a9583325a59f8a26a3cef524db638c6c98863e25 /clang/lib | |
parent | 0138a05557052f587a3b4b5cb1041893dc03f582 (diff) | |
download | bcm5719-llvm-a02bb37a8c372f6059c072919a1dd103988ca81d.tar.gz bcm5719-llvm-a02bb37a8c372f6059c072919a1dd103988ca81d.zip |
Diagnose the declaration of template template parameters that
themselves have no template parameters. This is actually a restriction
due to the grammar of template template parameters, but we choose to
diagnose it in Sema to provide better recovery.
llvm-svn: 117032
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Parse/ParseTemplate.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/Parse/ParseTemplate.cpp b/clang/lib/Parse/ParseTemplate.cpp index 8142cd226b5..c472972e5cb 100644 --- a/clang/lib/Parse/ParseTemplate.cpp +++ b/clang/lib/Parse/ParseTemplate.cpp @@ -540,7 +540,7 @@ Parser::ParseTemplateTemplateParameter(unsigned Depth, unsigned Position) { TemplateParamsTy *ParamList = Actions.ActOnTemplateParameterList(Depth, SourceLocation(), TemplateLoc, LAngleLoc, - &TemplateParams[0], + TemplateParams.data(), TemplateParams.size(), RAngleLoc); diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index cd67955a22a..95b2223658c 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -666,7 +666,7 @@ Decl *Sema::ActOnTemplateTemplateParameter(Scope* S, TemplateTemplateParmDecl::Create(Context, Context.getTranslationUnitDecl(), NameLoc.isInvalid()? TmpLoc : NameLoc, Depth, Position, Name, - (TemplateParameterList*)Params); + Params); // If the template template parameter has a name, then link the identifier // into the scope and lookup mechanisms. @@ -694,6 +694,11 @@ Decl *Sema::ActOnTemplateTemplateParameter(Scope* S, Param->setDefaultArgument(DefaultArg, false); } + if (Params->size() == 0) { + Diag(Param->getLocation(), diag::err_template_template_parm_no_parms) + << SourceRange(Params->getLAngleLoc(), Params->getRAngleLoc()); + Param->setInvalidDecl(); + } return Param; } |