From 5ea36d20c352a3ca436aa764404f6210b090866b Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 3 Dec 2020 13:55:51 -0500 Subject: [PATCH] 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. --- gcc/testsuite/g++.dg/cpp2a/concepts-nodiscard1.C | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-nodiscard1.C diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-nodiscard1.C b/gcc/testsuite/g++.dg/cpp2a/concepts-nodiscard1.C new file mode 100644 index 00000000000..28ce29b8bb0 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-nodiscard1.C @@ -0,0 +1,10 @@ +// PR c++/98019 +// { dg-do compile { target c++20 } } + +template concept same_as = __is_same_as (T, U); + +[[nodiscard]] int foo() { return 0; } +[[maybe_unused]] constexpr bool b = requires { + { foo() } -> same_as; +}; +[[maybe_unused]] constexpr auto x = sizeof(foo()); -- 2.30.2