aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1z/init-statement5.C
blob: cf2b16a27bb3faac3b95792338e91c8a352efdbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Testcase from P0305R1
// { dg-options -std=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;
}