Hi Richard,<br><br>Thanks for the suggestions! <br><br>Attached updated patch. The parser now will parse C++11 attribute specifiers, in the form of double squares that appear at all possible syntactic locations following class-name in a class specifier (also before or after 'final' keyword). In case of final keyword, I have not found a way to classify the nature of the class specifier without using tentative parsing. Also updated test cases.<br>
<br>I will look into fix-it in a separate patch. <br><br>Cheers<br>Michael<br><br><div class="gmail_quote">On Thu, Nov 15, 2012 at 10:32 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Thu, Nov 15, 2012 at 10:33 AM, Michael Han <<a href="mailto:fragmentshaders@gmail.com">fragmentshaders@gmail.com</a>> wrote:<br>

> Hi,<br>
><br>
> Consider this code<br>
> class [[foo]] c [[foo]];<br>
><br>
> Clang generates diagnostic like this:<br>
> error: an attribute list cannot appear here<br>
> class [[foo]] c [[foo]];<br>
>       ^~~~<br>
><br>
> I think the first attribute is conforming, and it's the second attribute<br>
> that should be diagnosed.<br>
<br>
</div>Yes, I agree that it would be better to point the diagnostic at the<br>
second attribute-specifier-seq (and ideally to say that it's in the<br>
wrong place, and offer a fixit...).<br>
<div class="im"><br>
> Attached the patch that fixes this.<br>
<br>
</div>I don't think your approach here is going to work. This is valid:<br>
<br>
  class c {};<br>
  class c [[ ]] x;<br>
<br>
I believe your patch would treat 'class c' as a declaration in the<br>
second line, which it is not.<br>
<br>
In order to correctly handle this, I suggest you parse attributes<br>
after the class name as well as before it, before trying to classify<br>
the reference. If you then find that it's a TUK_Reference, return the<br>
attributes you found after the class name to the caller, for them to<br>
handle appropriately. Otherwise, produce a diagnostic indicating that<br>
they were written in the wrong place (offering a fixit would be<br>
awesome...). For a class definition, you should probably look for<br>
attributes both before and after the optional 'final'.<br>
<br>
Thanks for looking into this!<br>
</blockquote></div><br>