Douglas Gregor | 0e8ff39 | 2012-02-01 00:09:55 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -std=c++11 -fblocks %s -verify |
| 2 | |
| 3 | void block_capture_errors() { |
| 4 | __block int var; // expected-note 2{{'var' declared here}} |
Douglas Gregor | 656bc62 | 2012-02-09 08:26:42 +0000 | [diff] [blame] | 5 | (void)[var] { }; // expected-error{{__block variable 'var' cannot be captured in a lambda}} |
Douglas Gregor | 0e8ff39 | 2012-02-01 00:09:55 +0000 | [diff] [blame] | 6 | |
Douglas Gregor | 656bc62 | 2012-02-09 08:26:42 +0000 | [diff] [blame] | 7 | (void)[=] { var = 17; }; // expected-error{{__block variable 'var' cannot be captured in a lambda}} |
Douglas Gregor | 0e8ff39 | 2012-02-01 00:09:55 +0000 | [diff] [blame] | 8 | } |