mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-25 21:51:37 +08:00
c++: Add testcase for PR98019
This has already been fixed on trunk, but I don't see a testcase for it. gcc/testsuite/ChangeLog: PR c++/98019 * g++.dg/cpp2a/concepts-nodiscard1.C: New test.
This commit is contained in:
parent
4a3b9f48c3
commit
5ea36d20c3
10
gcc/testsuite/g++.dg/cpp2a/concepts-nodiscard1.C
Normal file
10
gcc/testsuite/g++.dg/cpp2a/concepts-nodiscard1.C
Normal file
@ -0,0 +1,10 @@
|
||||
// PR c++/98019
|
||||
// { dg-do compile { target c++20 } }
|
||||
|
||||
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());
|
Loading…
x
Reference in New Issue
Block a user