aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2020-12-03 13:55:51 -0500
committerJason Merrill <jason@redhat.com>2020-12-03 13:56:56 -0500
commit5ea36d20c352a3ca436aa764404f6210b090866b (patch)
treecfb2d1635b28930f259ca5121322a766dfd15912 /gcc
parent4a3b9f48c3743c6737acdc93074d058c1603be2a (diff)
downloadgcc-5ea36d20c352a3ca436aa764404f6210b090866b.zip
gcc-5ea36d20c352a3ca436aa764404f6210b090866b.tar.gz
gcc-5ea36d20c352a3ca436aa764404f6210b090866b.tar.bz2
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-nodiscard1.C10
1 files changed, 10 insertions, 0 deletions
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 0000000..28ce29b
--- /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 <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());