attribute((malloc)) with arguments · Issue #51607 · llvm/llvm-project (original) (raw)

Bugzilla Link 52265
Version trunk
OS All
CC @zygoloid

Extended Description

GCC 11.x added support for arguments to attribute (malloc):

For example:

$ cat test.c
typedef struct my_s {} my;
void myclose (my*);
attribute ((malloc, malloc (myclose))) my* myopen(void);

$ gcc-11 -c test.c
(works)

$ clang-13 -c test.c
test.c:3:25: error: 'malloc' attribute takes no arguments
attribute ((malloc, malloc (myclose))) my* myopen(void);
^