28 lines · c
1// RUN: %clang_cc1 -std=c23 -fsyntax-only -verify %s2 3_Alignas(int) struct c1; // expected-warning {{'_Alignas' attribute ignored}}4alignas(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 error8__attribute__(()) alignas(int) [[]] int b; // expected-error {{an attribute list cannot appear here}}9__attribute__(()) alignas(int) int c; // expected-none10[[]] __attribute__(()) alignas(int) int d; // expected-none11alignas(int) [[]] __attribute__(()) int e; // expected-error {{an attribute list cannot appear here}}12 13struct 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-none17 [[]] __attribute__(()) alignas(int) int d; // expected-none18 alignas(int) [[]] __attribute__(()) int e; // expected-error {{an attribute list cannot appear here}}19};20 21void 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-none25 [[]] __attribute__(()) alignas(int) int d; // expected-none26 alignas(int) [[]] __attribute__(()) int e; // expected-error {{an attribute list cannot appear here}}27}28