gcc/testsuite/g++.dg/cpp2a/nontype-class54.C
raw| 1 | // PR c++/104278 |
| 2 | // { dg-do compile { target c++20 } } |
| 3 | |
| 4 | struct foo { |
| 5 | int value; |
| 6 | constexpr foo modify() const { return { value + 1 }; } |
| 7 | }; |
| 8 | |
| 9 | template<foo f, bool Enable = f.value & 1> |
| 10 | struct bar { |
| 11 | static void run() { } |
| 12 | }; |
| 13 | |
| 14 | template<foo f> |
| 15 | struct qux { |
| 16 | static void run() { |
| 17 | bar<f.modify()>::run(); |
| 18 | } |
| 19 | }; |
| 20 | |
| 21 | int main() { |
| 22 | qux<foo{}>::run(); |
| 23 | } |