https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86483
Bug ID: 86483 Summary: alloc_size attribute does not work on functions returning a struct that contains the pointer Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gonzalobg88 at gmail dot com Target Milestone: --- I am trying to implementing P0901r0 [0] in jemalloc. The signature of the new memory allocation function looks like this: typedef struct { void *ptr; size_t usize; } smallocx_return_t; smallocx_return_t je_smallocx(size_t size, int flags); I have to set the alloc_size attribute for smallocx_return_t.ptr, but AFAICT this is not currently possible. [0]: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0901r0.html