aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1z/constexpr-if32.C
blob: 13a6039fce69c5c3ca9c7391969be7c6d2fe9ce4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// PR c++/81676 - bogus -Wunused warnings in constexpr if.
// { dg-do compile { target c++17 } }
// { dg-options "-Wall -Wextra" }

int main()
{
    auto f = [](auto a, auto b) {
        if constexpr (sizeof(b) == 1) {
            return a;
        } else {
            return b;
        }
    };

    return f(1, 1) + f(1, 'a');
}