[cfe-dev] [PATCH]: Sema support for C++ classes

Eli Friedman eli.friedman at gmail.com
Fri Jun 27 19:44:18 PDT 2008


On Fri, Jun 27, 2008 at 6:56 PM, Argiris Kirtzidis <akyrtzi at gmail.com> wrote:
>> On a somewhat related note, the comment "// Attributes are only
>> allowed on the second declarator." in ParseCXXClassMemberDeclaration
>> is wrong, I think; g++ accepts "class C {int a
>> __attribute((mode(HI)));};".
>>
>
> I copied the attribute parsing from ParseStructDeclaration.
> The attribute you mention is parsed some lines before with:
>
>>
>>    // If attributes exist after the declarator, parse them.
>>    if (Tok.is(tok::kw___attribute))
>>      DeclaratorInfo.AddAttributes(ParseAttributes());
>
> Nevertheless, that comment seems a bit misleading to me too..

Ah, mmm... the construct that it's talking about is something like
"struct S {int a, __attribute((aligned(8))) b;};".  (For some strange
reason, gcc only accepts this particular snippet in C++ mode.)  The
comment could definitely be made clearer, though.

-Eli



More information about the cfe-dev mailing list