bwendling wrote:

@rapidsna @delcypher @apple-fcloutier @kees:

Okay, I think I see what the complication is. Are you trying to prevent the use 
case of someone writing something like:

```c
struct bar;

struct foo {
  size_t count;
  struct bar *ptr __counted_by(count);
};
```

where `ptr` is a pointer to one large space where that the user splits up into 
`count` number of `struct bar` objects?

```c
struct foo *alloc_foo(size_t count) {
  struct foo *p = malloc(sizeof(struct foo));

  p->count;
  p->ptr = malloc(sizeof(struct bar) * count); // struct bar can't be 
incomplete here
  return p;
}
```


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

Reply via email to