gcc/testsuite/g++.dg/cpp1z/constexpr-if37.C
raw| 1 | // PR c++/105885 |
| 2 | // { dg-do compile { target c++17 } } |
| 3 | // { dg-additional-options -Wall } |
| 4 | |
| 5 | int i; |
| 6 | |
| 7 | template<const char* ARG = nullptr> |
| 8 | void test() { |
| 9 | if constexpr(ARG == nullptr) { |
| 10 | ++i; |
| 11 | } else { |
| 12 | --i; |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | const char CONSTSTR[] = {'\n', '\t', ' ', '\0'}; |
| 17 | |
| 18 | int main() { |
| 19 | test(); |
| 20 | test<CONSTSTR>(); |
| 21 | } |