@@ -226,15 +226,49 @@ extern void abc_02(func_type *);
226226 func_ptr ();
227227} // expected-warning {{function declared 'noreturn' should not return}}
228228
229- [[noreturn]] void test_lambda () {
229+ [[noreturn]] void test_lambda_capture_ref () {
230230 func_type func_ptr = noret;
231231 [&func_ptr]() { func_ptr = ordinary; } ();
232232 func_ptr ();
233233} // expected-warning {{function declared 'noreturn' should not return}}
234234
235- [[noreturn]] void test_lambda_var ( int x ) {
235+ [[noreturn]] void test_lambda_var_capture_ref ( ) {
236236 func_type func_ptr = noret;
237- auto LF = [&](){func_ptr = ordinary;};
237+ auto LF = [&func_ptr ](){func_ptr = ordinary; };
238238 LF ();
239239 func_ptr ();
240240} // expected-warning {{function declared 'noreturn' should not return}}
241+
242+ [[noreturn]] void test_lambda_capture_ref_all () {
243+ func_type func_ptr = noret;
244+ [&]() { func_ptr = ordinary; } ();
245+ func_ptr ();
246+ } // expected-warning {{function declared 'noreturn' should not return}}
247+
248+ [[noreturn]] void test_lambda_var_capture_ref_all () {
249+ func_type func_ptr = noret;
250+ auto LF = [&](){func_ptr = ordinary; };
251+ LF ();
252+ func_ptr ();
253+ } // expected-warning {{function declared 'noreturn' should not return}}
254+
255+ [[noreturn]] void lambda_capture_by_value () {
256+ func_type func_ptr = noret;
257+ auto LF = [func_ptr](){ return func_ptr; };
258+ LF ();
259+ func_ptr ();
260+ }
261+
262+ [[noreturn]] void lambda_pass_by_ref () {
263+ func_type func_ptr = noret;
264+ auto LF = [](func_type &fptr){ fptr = ordinary; };
265+ LF (func_ptr);
266+ func_ptr ();
267+ } // expected-warning {{function declared 'noreturn' should not return}}
268+
269+ [[noreturn]] void lambda_pass_by_value () {
270+ func_type func_ptr = noret;
271+ auto LF = [](func_type fptr){ fptr = ordinary; };
272+ LF (func_ptr);
273+ func_ptr ();
274+ }
0 commit comments