Debian Codegraph @

gcc/testsuite/g++.dg/cpp1z/init-statement5.C

raw
1 // Testcase from P0305R1
2 // { dg-do compile { target c++17 } }
3
4 enum class status_code { SUCCESS };
5 extern int get_value ();
6 status_code bar (int);
7 status_code do_more_stuff (void);
8
9 status_code
10 foo ()
11 {
12 int n = get_value ();
13 if (status_code c = bar (n); c != status_code::SUCCESS) { return c; }
14 if (status_code c = do_more_stuff (); c != status_code::SUCCESS) { return c; }
15 return status_code::SUCCESS;
16 }