https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016
--- Comment #28 from Jakub Jelinek <jakub at gcc dot gnu.org> --- It would need to be a FE keyword where __builtin_get_counted_by would return some pointer, either e.g. (void *)0 if it doesn't have a count, or a pointer to the count (with type of the pointer dependent on what type the count has). Speaking of counted_by, I see support for it in c-family/ and c/, but not in cp/ at all, what is the attribute supposed to do in C++? If it isn't supported, it should be documented that it doesn't apply to C++ and should be rejected in C++. If it is to be supported, the support (including support for templates) needs to be there before GCC 15.