From: Saleem Abdulrasool Date: Sat, 31 Oct 2015 00:39:15 +0000 (+0000) Subject: Sema: correct typo recovery with blocks X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2970073f297a859cd0e29be112369b8790aa7678;p=clang Sema: correct typo recovery with blocks Handle blocks in the tree transform for the typo correction as otherwise, the capture may miss. This would trigger an assertion. Thanks to Doug Gregor for the help with this! Fixes PR25001. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251729 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 348f29638e..dfaa4503ff 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -6545,6 +6545,8 @@ public: ExprResult TransformLambdaExpr(LambdaExpr *E) { return Owned(E); } + ExprResult TransformBlockExpr(BlockExpr *E) { return Owned(E); } + ExprResult Transform(Expr *E) { ExprResult Res; while (true) { diff --git a/test/SemaCXX/typo-correction-blocks.c b/test/SemaCXX/typo-correction-blocks.c new file mode 100644 index 0000000000..300a5be396 --- /dev/null +++ b/test/SemaCXX/typo-correction-blocks.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -triple i386-apple-macosx -fblocks -fsyntax-only -verify %s + +extern int h(int *); +extern void g(int, void (^)(void)); +extern int fuzzys; // expected-note {{'fuzzys' declared here}} + +static void f(void *v) { + g(fuzzy, ^{ // expected-error {{did you mean 'fuzzys'}} + int i = h(v); + }); +} +