bwendling wrote: > Note the attribute is prevented on pointee types where the size isn't known > at compile time. In particular pointee types that are: > > * Incomplete (e.g. `void`) and sizeless types > * Function types (e.g. the pointee of a function pointer) > * Struct types with a flexible array member
I've been thinking about this restriction. Why is this necessary? My assumption was that applying `counted_by` to a pointer causes a bounds check on an index into the __pointer__ rather than its underlying type. So something like: ```c struct foo; struct bar { int a; int fam[] __counted_by(a); }; struct x { void *p __counted_by(count); // void * is treated like char *, I think. struct foo *f __counted_by(count); // sizeof(f) is the size of a general pointer. struct bar *b __counted_by(count); // a list of pointers to 'struct bar's should be okay. int count; }; ``` https://github.com/llvm/llvm-project/pull/90786 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits