1 // PR c++/54021
2 // { dg-do compile { target c++11 } }
3 
4 extern int nonconst_func(int);
identity(int x)5 constexpr int identity(int x) { return x; }
zero()6 constexpr int zero() { return identity(0); }
one()7 constexpr int one() { return identity(1); }
8 
9 // These are the same.  Only the latter is accepted, though.
rejected_const_4(int x)10 constexpr int rejected_const_4(int x)
11 { return __builtin_constant_p(x) ? 4 : nonconst_func(x); }
accepted_const_4(int x)12 constexpr int accepted_const_4(int x)
13 { return identity(__builtin_constant_p(x)) ? 4 : nonconst_func(x); }
14 
15 // This is rejected.  I would like it to work.
16 constexpr int four = accepted_const_4(1);
17