aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-3.c
blob: 957383756a8c9ee364df8c31a90879537b6e85ce (plain)
1
2
3
4
5
6
7
8
9
10
11
/* Test C23 nodiscard attribute: invalid syntax.  */
/* { dg-do compile } */
/* { dg-options "-std=c23 -pedantic-errors" } */

[[nodiscard()]] int a (void); /* { dg-error "parentheses must be omitted if attribute argument list is empty" } */

[[nodiscard(0)]] int b (void); /* { dg-error "expected" } */

[[nodiscard("", 123)]] int c (void); /* { dg-error "expected" } */

[[nodiscard((""))]] int d (void); /* { dg-error "expected" } */