1 // PR c++/87594 2 // { dg-do compile { target c++14 } } 3 always_false()4constexpr bool always_false() { return false; } f()5int f() { return 1; } 6 7 constexpr int fn1()8fn1() 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()20fn2 () 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()29fn3 () 30 { 31 __extension__ int a[] = { }; 32 for (auto x : a) 33 f(); 34 return 0; 35 } 36 37 38 void bar()39bar () 40 { 41 constexpr int i1 = fn1 (); 42 constexpr int i2 = fn2 (); // { dg-message "in .constexpr. expansion of " } 43 constexpr int i3 = fn3 (); 44 } 45