// expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'struct size_unknown' is an incomplete type}}
structsize_unknown*buf__counted_by(count);
};
structon_member_pointer_const_incomplete_ty{
intcount;
// expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'const struct size_unknown' is an incomplete type}}
conststructsize_unknown*buf__counted_by(count);
};
structon_member_pointer_void_ty{
intcount;
// expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'void' is an incomplete type}}
void*buf__counted_by(count);
};
structon_member_pointer_fn_ptr_ty{
intcount;
// buffer of `count` function pointers is allowed
void(**fn_ptr)(void)__counted_by(count);
};
structon_member_pointer_fn_ptr_ty_ptr_ty{
intcount;
// buffer of `count` function pointers is allowed
fn_ptr_ty*fn_ptr__counted_by(count);
};
structon_member_pointer_fn_ty{
intcount;
// buffer of `count` functions is not allowed
// expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'void (void)' is a function type}}
void(*fn_ptr)(void)__counted_by(count);
};
structon_member_pointer_fn_ptr_ty_ty{
intcount;
// buffer of `count` functions is not allowed
// expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'void (void)' is a function type}}
fn_ptr_tyfn_ptr__counted_by(count);
};
structhas_unannotated_vla{
intcount;
intbuffer[];
};
structon_member_pointer_struct_with_vla{
intcount;
// expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'struct has_unannotated_vla' is a struct type with a flexible array member}}
// expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'struct has_annotated_vla' is a struct type with a flexible array member}}
// expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'const struct size_unknown' is an incomplete type}}
conststructsize_unknown*__counted_by(count)buf;
};
structon_member_pointer_void_ty_ty_pos{
intcount;
// expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'void' is an incomplete type}}
void*__counted_by(count)buf;
};
// -
structon_member_pointer_fn_ptr_ty_pos{
intcount;
// buffer of `count` function pointers is allowed
void(**__counted_by(count)fn_ptr)(void);
};
structon_member_pointer_fn_ptr_ty_ptr_ty_pos{
intcount;
// buffer of `count` function pointers is allowed
fn_ptr_ty*__counted_by(count)fn_ptr;
};
structon_member_pointer_fn_ty_ty_pos{
intcount;
// buffer of `count` functions is not allowed
// expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'void (void)' is a function type}}
void(*__counted_by(count)fn_ptr)(void);
};
structon_member_pointer_fn_ptr_ty_ty_pos{
intcount;
// buffer of `count` functions is not allowed
// expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'void (void)' is a function type}}
fn_ptr_ty__counted_by(count)fn_ptr;
};
// TODO: This should be forbidden but isn't due to counted_by being treated
// as a declaration attribute.
structon_member_pointer_fn_ptr_ty_ty_pos_inner{
intcount;
void(*__counted_by(count)*fn_ptr)(void);
};
structon_member_pointer_struct_with_vla_ty_pos{
intcount;
// expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'struct has_unannotated_vla' is a struct type with a flexible array member}}
// expected-error@+1{{counted_by' cannot be applied to a pointer with pointee of unknown size because 'struct has_annotated_vla' is a struct type with a flexible array member}}