aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/concepts-nodiscard1.C
blob: 3d5cd85bc943e9ec6f842d36bdc1b43fe497ddd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
// PR c++/98019
// { dg-do compile { target c++20 } }
// Don't give [[nodiscard]] warning for an expression requirement.

template <class T, class U> concept same_as = __is_same_as (T, U);

[[nodiscard]] int foo() { return 0; }
[[maybe_unused]] constexpr bool b = requires {
    { foo() } -> same_as<int>;
};
[[maybe_unused]] constexpr auto x = sizeof(foo());