aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1z/init-statement5.C
blob: 867955b285eb331262e65c25530b572f5bb80f67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Testcase from P0305R1
// { dg-do compile { target c++17 } }

enum class status_code { SUCCESS };
extern int get_value ();
status_code bar (int);
status_code do_more_stuff (void);

status_code
foo ()
{
  int n = get_value ();
  if (status_code c = bar (n); c != status_code::SUCCESS) { return c; }
  if (status_code c = do_more_stuff (); c != status_code::SUCCESS) { return c; }
  return status_code::SUCCESS;
}