]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/g++.dg/cpp2a/nodiscard-reason-only-one.C
Implement C++20 P1301 [[nodiscard("should have a reason")]].
[thirdparty/gcc.git] / gcc / testsuite / g++.dg / cpp2a / nodiscard-reason-only-one.C
1 /* nodiscard attribute tests */
2 /* { dg-do compile { target c++2a } } */
3 /* { dg-options "-O -ftrack-macro-expansion=0" } */
4
5 [[nodiscard("not", "allowed")]] int check1 (void); /* { dg-error "(?n)wrong number of arguments..*nodiscard" } */
6
7 void
8 test (void)
9 {
10 check1 ();
11 (void) check1 ();
12 }