xref: /llvm-project/clang/test/Sema/attr-counted-by-struct-ptrs-sizeless-types.c (revision 876ee11eeeb2b6a7ccfefea00265b4bfd5f9b6dd)
1 // __SVInt8_t is specific to ARM64 so specify that in the target triple
2 // RUN: %clang_cc1 -triple arm64-apple-darwin -fsyntax-only -verify %s
3 // RUN: %clang_cc1 -fexperimental-late-parse-attributes -triple arm64-apple-darwin -fsyntax-only -verify %s
4 
5 #define __counted_by(f)  __attribute__((counted_by(f)))
6 
7 struct on_sizeless_pointee_ty {
8     int count;
9     // expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because '__SVInt8_t' is a sizeless type}}
10     __SVInt8_t* member __counted_by(count);
11 };
12 
13 struct on_sizeless_ty {
14     int count;
15     // expected-error@+2{{'counted_by' only applies to pointers or C99 flexible array members}}
16     // expected-error@+1{{field has sizeless type '__SVInt8_t'}}
17     __SVInt8_t member __counted_by(count);
18 };
19