prefixed gnu style attributes are ignored on tag types


It looks like clang parser ignores gnu style attributes prefixed on the tag types. For example (assume attr is an implementation defined attribute):

class attribute((attr)) foo ; // works

attribute((attr)) class foo; // doesn’t work; the attribute is parsed while parsing declaration specifiers but doesn’t get merged into the attribute list while parsing the class specifier. So the attribute never makes to Sema.

I am wondering why the parser ignores the prefixed attributes. Is this for gcc compatibility? (from, it looks like prefixed attribute is not one of the “legal” syntax of gcc type attributes).



That position would apply to the declared objects, so we should at least diagnose that they're being ignored here.