]> granicus.if.org Git - clang/commitdiff
Correct delayed typos in the operand to typeof expressions.
authorKaelyn Takata <rikka@google.com>
Fri, 19 Dec 2014 01:28:40 +0000 (01:28 +0000)
committerKaelyn Takata <rikka@google.com>
Fri, 19 Dec 2014 01:28:40 +0000 (01:28 +0000)
Fixes PR21947.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224558 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDecl.cpp
test/SemaCXX/typo-correction-delayed.cpp

index 0b84f2fbbd50b97f9790d9be91acf363346c6db6..888e8eea253d17383a878aee7aa6de37c346f75c 100644 (file)
@@ -5932,8 +5932,8 @@ void Parser::ParseTypeofSpecifier(DeclSpec &DS) {
   bool isCastExpr;
   ParsedType CastTy;
   SourceRange CastRange;
-  ExprResult Operand = ParseExprAfterUnaryExprOrTypeTrait(OpTok, isCastExpr,
-                                                          CastTy, CastRange);
+  ExprResult Operand = Actions.CorrectDelayedTyposInExpr(
+      ParseExprAfterUnaryExprOrTypeTrait(OpTok, isCastExpr, CastTy, CastRange));
   if (hasParens)
     DS.setTypeofParensRange(CastRange);
 
index a9bc91e0308d3d248fa838609a3e93cd22fb5f1a..49bb14fe8ce75c4512859b85f5f98a8c538b72f7 100644 (file)
@@ -147,3 +147,8 @@ void test() {
 namespace PR21905 {
 int (*a) () = (void)Z;  // expected-error-re {{use of undeclared identifier 'Z'{{$}}}}
 }
+
+namespace PR21947 {
+int blue;  // expected-note {{'blue' declared here}}
+__typeof blur y;  // expected-error {{use of undeclared identifier 'blur'; did you mean 'blue'?}}
+}