gcc/testsuite/g++.dg/cpp1z/constexpr-ref2.C
raw| 1 | // P2280R4 - Using unknown pointers and references in constant expressions |
| 2 | // PR c++/106650 |
| 3 | // { dg-do compile { target c++17 } } |
| 4 | |
| 5 | template <bool V> |
| 6 | struct Widget { |
| 7 | struct Config { |
| 8 | static constexpr bool value = V; |
| 9 | } config; |
| 10 | |
| 11 | void f() { |
| 12 | if constexpr (config.value) { |
| 13 | // ... |
| 14 | } |
| 15 | } |
| 16 | }; |
| 17 | |
| 18 | void |
| 19 | g () |
| 20 | { |
| 21 | Widget<false> w; |
| 22 | w.f(); |
| 23 | } |