gcc/testsuite/gcc.dg/c23-attr-nodiscard-3.c
raw| 1 | /* Test C23 nodiscard attribute: invalid syntax. */ |
| 2 | /* { dg-do compile } */ |
| 3 | /* { dg-options "-std=c23 -pedantic-errors" } */ |
| 4 | |
| 5 | [[nodiscard()]] int a (void); /* { dg-error "parentheses must be omitted if attribute argument list is empty" } */ |
| 6 | |
| 7 | [[nodiscard(0)]] int b (void); /* { dg-error "expected" } */ |
| 8 | |
| 9 | [[nodiscard("", 123)]] int c (void); /* { dg-error "expected" } */ |
| 10 | |
| 11 | [[nodiscard((""))]] int d (void); /* { dg-error "expected" } */ |