gcc/testsuite/g++.dg/cpp1z/constexpr-if32.C
raw| 1 | // PR c++/81676 - bogus -Wunused warnings in constexpr if. |
| 2 | // { dg-do compile { target c++17 } } |
| 3 | // { dg-options "-Wall -Wextra" } |
| 4 | |
| 5 | int main() |
| 6 | { |
| 7 | auto f = [](auto a, auto b) { |
| 8 | if constexpr (sizeof(b) == 1) { |
| 9 | return a; |
| 10 | } else { |
| 11 | return b; |
| 12 | } |
| 13 | }; |
| 14 | |
| 15 | return f(1, 1) + f(1, 'a'); |
| 16 | } |