------- Comment #7 from geoffk at gcc dot gnu dot org 2009-09-26 11:51 ------- I looked up 'weakref' in the GCC documentation because I'd forgotten exactly what it was supposed to do, and noticed that it's actually documented as applying only to functions. So, maybe we could just say that this attribute is only allowed for functions, and produce an error on line 3.
Alexandre's original mail proposing the extension, <http://gcc.gnu.org/ml/gcc/2005-10/msg00235.html>, suggests the attribute for both variables and functions, but the explanation of why you'd want this feature only talks about functions. The weakref documentation does specifically talk about the case where the function is referenced both via the weakref and directly through the original symbol, and I think the typical use cases actually do this. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25140