aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-3.c
blob: 2e70d12bff33e1f568ec14d5afa759d23e1d58f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
/* Test C2x nodiscard attribute: invalid syntax.  */
/* { dg-do compile } */
/* { dg-options "-std=c2x -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" } */