summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1y/constexpr-switch3.C
blob: 1aa1cf6bbaee69b06621dafc6619f919593f512f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// { dg-do compile { target c++14 } }

constexpr int f (int i)
{
  int j = 0;
  switch (i)
    {
    case 1:
      j = 42;
      break;
    default:
      j = 24;
      break;
    }
  return j;
}

constexpr int i = f(2);
#define SA(X) static_assert((X),#X)
SA(i==24);