summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/constexpr-47570.C
blob: c60ba86586222c411a74bc3efb9e6348eac9a078 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// PR c++/47570
// { dg-options -std=c++0x }

unsigned int constexpr one()
{ return 1; }

int constexpr one_B()
{ return 1; }

int main()
{
  // FAIL TO COMPILE:
  static bool constexpr SC_huh1 = ((unsigned int)one()) >= ((unsigned int)0);
  static bool constexpr SC_huh2 = one() >= ((unsigned int)0);
  static bool constexpr SC_huh3 = one() >= 0;

  // COMPILE OK:
  static bool constexpr SC_huh4 = ((one() == 0) || (one() > 0));
  static bool constexpr SC_huh5 = one() == 0;
  static bool constexpr SC_huh6 = one() > 0;
  static bool constexpr SC_huh7 = one_B() >= 0;
  static bool constexpr SC_huh8 = one() >= 1;

  return SC_huh3;
}