view gcc/testsuite/g++.dg/cpp1z/init-statement5.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// 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;
}