diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-11-29 09:09:06 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-11-29 09:09:06 +0000 |
commit | 6e1fd33116c2977174f2df17ac8bad2a32659db8 (patch) | |
tree | 579a44c9076fbd7331737adfc5f8614e1f07c7ea /lib/Parse/ParseTemplate.cpp | |
parent | 2fea2242fe7e7c37df1e96316616febeaf4e29eb (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145395 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseTemplate.cpp')
-rw-r--r-- | lib/Parse/ParseTemplate.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp index 91cf8e81c2..7b09f8191d 100644 --- a/lib/Parse/ParseTemplate.cpp +++ b/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); |