1 // { dg-do compile { target c++14 } }
2 
f1()3 constexpr void f1() {
4   if (false)
5     throw;
6 }
7 
f2()8 constexpr void f2() {
9   if (true)
10     throw;	// { dg-error "not a constant expression" }
11 }
12 
f3()13 constexpr void f3() {
14   if (false)
15     ;
16   else
17     throw;	// { dg-error "not a constant expression" }
18 }
19 
f4()20 constexpr void f4() {
21   throw;	// { dg-error "not a constant expression" }
22 }
23 
fun(int n)24 constexpr int fun(int n) {
25   switch (n) {
26   case 0:
27     return 1;
28   default:
29     throw; // { dg-error "not a constant expression" }
30   }
31 }
32 
33 static_assert(fun(0), "");
34 static_assert(fun(1), ""); // { dg-error "non-constant|in .constexpr. expansion of" }
35