gcc/testsuite/g++.dg/cpp1y/constexpr-loop5.C
raw| 1 | // PR c++/68530 |
| 2 | // { dg-do compile { target c++14 } } |
| 3 | |
| 4 | struct thing { |
| 5 | void foo() {} |
| 6 | }; |
| 7 | |
| 8 | template<typename> |
| 9 | constexpr int count() |
| 10 | { |
| 11 | auto item = thing {}; |
| 12 | for(; (item.foo(), false);); // { dg-error "foo" "" { target { ! implicit_constexpr } } } |
| 13 | return 0; |
| 14 | } |
| 15 | |
| 16 | int main() |
| 17 | { |
| 18 | static_assert( count<int>() == 0, "" ); // { dg-error "" "" { target { ! implicit_constexpr } } } |
| 19 | } |