summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@google.com>2010-04-08 21:04:54 +0000
committerJeffrey Yasskin <jyasskin@google.com>2010-04-08 21:04:54 +0000
commit54eba427ed4b415c636670aa0b1edaccf7b5ac9e (patch)
treedcb883c6d6deca25da1ee65c33ff00d20e659725 /clang/lib/Sema
parent433d40695bb7d6876e540e84c4fc5fd270edc311 (diff)
downloadbcm5719-llvm-54eba427ed4b415c636670aa0b1edaccf7b5ac9e.tar.gz
bcm5719-llvm-54eba427ed4b415c636670aa0b1edaccf7b5ac9e.zip
Explain that a template needs arguments to make it into a type, for
variable declarations. llvm-svn: 100809
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 92d2f4b50c5..82cecc3f4d0 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -275,6 +275,24 @@ bool Sema::DiagnoseUnknownTypeName(const IdentifierInfo &II,
}
}
+ if (getLangOptions().CPlusPlus) {
+ // See if II is a class template that the user forgot to pass arguments to.
+ UnqualifiedId Name;
+ Name.setIdentifier(&II, IILoc);
+ CXXScopeSpec EmptySS;
+ TemplateTy TemplateResult;
+ if (isTemplateName(S, SS ? *SS : EmptySS, Name, 0, true, TemplateResult)
+ == TNK_Type_template) {
+ TemplateName TplName = TemplateResult.getAsVal<TemplateName>();
+ Diag(IILoc, diag::err_template_missing_args) << TplName;
+ if (TemplateDecl *TplDecl = TplName.getAsTemplateDecl()) {
+ Diag(TplDecl->getLocation(), diag::note_template_decl_here)
+ << TplDecl->getTemplateParameters()->getSourceRange();
+ }
+ return true;
+ }
+ }
+
// FIXME: Should we move the logic that tries to recover from a missing tag
// (struct, union, enum) from Parser::ParseImplicitInt here, instead?
OpenPOWER on IntegriCloud