Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/concepts-nodiscard1.C

raw
1 // PR c++/98019
2 // { dg-do compile { target c++20 } }
3 // Don't give [[nodiscard]] warning for an expression requirement.
4
5 template <class T, class U> concept same_as = __is_same_as (T, U);
6
7 [[nodiscard]] int foo() { return 0; }
8 [[maybe_unused]] constexpr bool b = requires {
9 { foo() } -> same_as<int>;
10 };
11 [[maybe_unused]] constexpr auto x = sizeof(foo());