gcc/testsuite/g++.dg/cpp1y/func_constexpr2.C
raw| 1 | // PR c++/87372 |
| 2 | // { dg-do compile { target c++14 } } |
| 3 | |
| 4 | constexpr int |
| 5 | foo (char const *s) |
| 6 | { |
| 7 | int i = 0; |
| 8 | while (s[i]) |
| 9 | ++i; |
| 10 | return i; |
| 11 | } |
| 12 | |
| 13 | constexpr int |
| 14 | bar () |
| 15 | { |
| 16 | constexpr int l = foo (__PRETTY_FUNCTION__); |
| 17 | constexpr int l2 = foo (__FUNCTION__); |
| 18 | constexpr int l3 = foo (__func__); |
| 19 | return l + l2 + l3; |
| 20 | } |
| 21 | static_assert (bar () == 25, ""); |