summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseTemplate.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2011-11-29 09:09:06 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2011-11-29 09:09:06 +0000
commit53711607a080d75a6a2276bba9322243b445789d (patch)
tree203a7fbe9e890a5ac229f34d410023d4c48d7a48 /clang/lib/Parse/ParseTemplate.cpp
parent004685bdf7bd8b9e58b7d7864a87696ccc9ca5ac (diff)
downloadbcm5719-llvm-53711607a080d75a6a2276bba9322243b445789d.tar.gz
bcm5719-llvm-53711607a080d75a6a2276bba9322243b445789d.zip
Add fix-it to remove 'typedef' from function template definitions. Such a token
was probably meant to be 'typename', which we will have already suggested if it is appropriate. llvm-svn: 145395
Diffstat (limited to 'clang/lib/Parse/ParseTemplate.cpp')
-rw-r--r--clang/lib/Parse/ParseTemplate.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Parse/ParseTemplate.cpp b/clang/lib/Parse/ParseTemplate.cpp
index 91cf8e81c2a..7b09f8191d2 100644
--- a/clang/lib/Parse/ParseTemplate.cpp
+++ b/clang/lib/Parse/ParseTemplate.cpp
@@ -276,9 +276,11 @@ Parser::ParseSingleDeclarationAfterTemplate(
if (DeclaratorInfo.isFunctionDeclarator() &&
isStartOfFunctionDefinition(DeclaratorInfo)) {
if (DS.getStorageClassSpec() == DeclSpec::SCS_typedef) {
- Diag(Tok, diag::err_function_declared_typedef);
-
- // Recover by ignoring the 'typedef'.
+ // Recover by ignoring the 'typedef'. This was probably supposed to be
+ // the 'typename' keyword, which we should have already suggested adding
+ // if it's appropriate.
+ Diag(DS.getStorageClassSpecLoc(), diag::err_function_declared_typedef)
+ << FixItHint::CreateRemoval(DS.getStorageClassSpecLoc());
DS.ClearStorageClassSpecs();
}
return ParseFunctionDefinition(DeclaratorInfo, TemplateInfo);
OpenPOWER on IntegriCloud