From 91126074006a2d7a21551fe46840426c91782297 Mon Sep 17 00:00:00 2001 From: Kaelyn Takata Date: Fri, 19 Dec 2014 01:28:40 +0000 Subject: [PATCH] Correct delayed typos in the operand to typeof expressions. Fixes PR21947. llvm-svn: 224558 --- clang/lib/Parse/ParseDecl.cpp | 4 ++-- clang/test/SemaCXX/typo-correction-delayed.cpp | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 0b84f2fbbd50..888e8eea253d 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -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); diff --git a/clang/test/SemaCXX/typo-correction-delayed.cpp b/clang/test/SemaCXX/typo-correction-delayed.cpp index a9bc91e0308d..49bb14fe8ce7 100644 --- a/clang/test/SemaCXX/typo-correction-delayed.cpp +++ b/clang/test/SemaCXX/typo-correction-delayed.cpp @@ -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'?}} +}