diff options
author | John McCall <rjmccall@apple.com> | 2013-03-22 02:10:40 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2013-03-22 02:10:40 +0000 |
commit | b760f11fae94e3003b9241ac50c02617465f2fa2 (patch) | |
tree | d0709d70ccbe6150d35452e68660bde46efe7e40 /test/SemaCXX/blocks.cpp | |
parent | bf8487a3c290203ae54fd81d35a94be0ff211235 (diff) |
Fix a crash-on-valid where a block capture copy expression was
picking up cleanups from earlier in the statement. Also fix a
crash-on-invalid where a reference to an invalid decl from an
enclosing scope was causing an expression to fail to build, but
only *after* a cleanup was registered from that statement,
causing an assertion downstream.
The crash-on-valid is rdar://13459289.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177692 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/blocks.cpp')
-rw-r--r-- | test/SemaCXX/blocks.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/test/SemaCXX/blocks.cpp b/test/SemaCXX/blocks.cpp index a635e998d9..a2672d13b7 100644 --- a/test/SemaCXX/blocks.cpp +++ b/test/SemaCXX/blocks.cpp @@ -1,5 +1,4 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s -fblocks -// expected-no-diagnostics void tovoid(void*); @@ -82,3 +81,22 @@ void move_block() { __block MoveOnly mo; } +// Don't crash after failing to build a block due to a capture of an +// invalid declaration. +namespace test5 { + struct B { // expected-note 2 {{candidate constructor}} + void *p; + B(int); // expected-note {{candidate constructor}} + }; + + void use_block(void (^)()); + void use_block_2(void (^)(), const B &a); + + void test() { + B x; // expected-error {{no matching constructor for initialization}} + use_block(^{ + int y; + use_block_2(^{ (void) y; }, x); + }); + } +} |