https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016
--- Comment #5 from qinzhao at gcc dot gnu.org --- (In reply to Jakub Jelinek from comment #4) > That is not a prototype. Prototype is what is the C or C++ function type of > the builtin. Neither ptr->FAM nor const_exp_with_int_type are valid C types. > There is no reason why the second argument should be const, it can be > anything convertible to whatever type size_t has, including say for C++ > classes with operator long (), _Bool/bool, enumerators, floating point > expressions, ... >From GCC doc: (https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005fcall_005fwith_005fstatic_005fchain) Built-in Function: type __builtin_call_with_static_chain (call_exp, pointer_exp) The call_exp expression must be a function call, and the pointer_exp expression must be a pointer. If we allow the second argument to be variable, I am fine. Then how about: void __builtin_set_counted_by (FAM_exp, exp) The FAM_exp expression must be a flexible array member reference. The second argument must be an expression that can be converted to the type of the flexible array member.