1 // PR c++/87594
2 // { dg-do compile { target c++14 } }
3 
always_false()4 constexpr bool always_false() { return false; }
f()5 int f() { return 1; }
6 
7 constexpr int
fn1()8 fn1()
9 {
10   struct empty_range {
11     constexpr int* begin() { return 0; }
12     constexpr int* end() { return 0; }
13   } e;
14   for (auto x : e)
15     f();
16   return 0;
17 }
18 
19 constexpr int
fn2()20 fn2 ()
21 {
22   int a[] = { 1, 2, 3 };
23   for (auto x : a)
24     f(); // { dg-error "call to non-.constexpr. function" }
25   return 0;
26 }
27 
28 constexpr int
fn3()29 fn3 ()
30 {
31   __extension__ int a[] = { };
32   for (auto x : a)
33     f();
34   return 0;
35 }
36 
37 
38 void
bar()39 bar ()
40 {
41   constexpr int i1 = fn1 ();
42   constexpr int i2 = fn2 (); // { dg-message "in .constexpr. expansion of " }
43   constexpr int i3 = fn3 ();
44 }
45