Debian Codegraph @

clang/test/Parser/c2x-alignas.c

raw
1 // RUN: %clang_cc1 -std=c23 -fsyntax-only -verify %s
2
3 _Alignas(int) struct c1; // expected-warning {{'_Alignas' attribute ignored}}
4 alignas(int) struct c1; // expected-warning {{'alignas' attribute ignored}}
5
6
7 __attribute__(()) [[]] alignas(int) int a; // expected-none TODO: actually this line should be an error
8 __attribute__(()) alignas(int) [[]] int b; // expected-error {{an attribute list cannot appear here}}
9 __attribute__(()) alignas(int) int c; // expected-none
10 [[]] __attribute__(()) alignas(int) int d; // expected-none
11 alignas(int) [[]] __attribute__(()) int e; // expected-error {{an attribute list cannot appear here}}
12
13 struct C1 {
14 __attribute__(()) [[]] alignas(int) int a; // expected-error {{an attribute list cannot appear here}}
15 __attribute__(()) alignas(int) [[]] int b; // expected-error {{an attribute list cannot appear here}}
16 __attribute__(()) alignas(int) int c; // expected-none
17 [[]] __attribute__(()) alignas(int) int d; // expected-none
18 alignas(int) [[]] __attribute__(()) int e; // expected-error {{an attribute list cannot appear here}}
19 };
20
21 void fn_with_decl() {
22 __attribute__(()) [[]] alignas(int) int a; // expected-error {{an attribute list cannot appear here}}
23 __attribute__(()) alignas(int) [[]] int b; // expected-error {{an attribute list cannot appear here}}
24 __attribute__(()) alignas(int) int c; // expected-none
25 [[]] __attribute__(()) alignas(int) int d; // expected-none
26 alignas(int) [[]] __attribute__(()) int e; // expected-error {{an attribute list cannot appear here}}
27 }