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 | 369ea27b56b89379023366ff1b8ab362b5709e4e (patch) | |
tree | 2edad0fc8601b2f783d79a9a92b3fc2bf5640fe2 /lib/Sema/SemaTemplate.cpp | |
parent | 0bab54cf82cd679152197c7a2eb938f8aa9f07dd (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117032 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index cd67955a22..95b2223658 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/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; } |