http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60915
Bug ID: 60915 Summary: confusing diagnostic from attribute on function definition Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: tromey at gcc dot gnu.org Consider this program: int something(void) __attribute__((__visibility__("default"))) { return 23; } Compiling gives: barimba. gcc --syntax-only t.c t.c:2:1: error: expected ‘,’ or ‘;’ before ‘{’ token { ^ A few notes here: First, while this is not the correct syntax, it seems natural enough that I've written it several times by mistake now. Is there any chance it could be blessed? Second, I think the diagnostic could be improved. For example it could mention that an attribute is not valid in this position on a definition, and suggest an alternative. Third, the manual could use an example of how to do this.