Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions test/native.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,42 @@ void test_capture_all(void) {
#endif // lambdas
}

void test_lambda(void) {

{
int i = 0, j = 1;
auto foo = [&]() {
BOOST_SCOPE_EXIT( (&i) (&j) ) {
i = j = 2; // modify references
}
BOOST_SCOPE_EXIT_END
};
foo();

BOOST_TEST(i == 2);
BOOST_TEST(j == 2);
}

{
auto bar = [&]() {
int i = 0, j = 1;
BOOST_SCOPE_EXIT( (&i) (&j) ) {
i = j = 2; // modify references
}
BOOST_SCOPE_EXIT_END

BOOST_TEST(i == 2);
BOOST_TEST(j == 2);
};
bar();
}
}

int main(void) {
test_non_local();
test_types();
test_capture_all();
test_lambda();
return boost::report_errors();
}