llvm-project/clang/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp

9 lines
341 B
C++

// RUN: %clang_cc1 -std=c++11 -fblocks %s -verify
void block_capture_errors() {
__block int var; // expected-note 2{{'var' declared here}}
(void)[var] { }; // expected-error{{__block variable 'var' cannot be captured in a lambda}}
(void)[=] { var = 17; }; // expected-error{{__block variable 'var' cannot be captured in a lambda}}
}