[cfe-dev] Attribute on constructor parameter rejected

Aaron Ballman aaron at aaronballman.com
Fri Sep 6 05:50:37 PDT 2013


Okay, so why did this work for me on ToT on Windows prior to your
patch?  Do we have different constructor disambiguation for
-fms-compatibility?

~Aaron

On Thu, Sep 5, 2013 at 8:15 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> On Thu, Sep 5, 2013 at 12:50 PM, Guillaume Papin
> <guillaume.papin at epitech.eu> wrote:
>>
>> Hum, I updated yesterday so it's quite recent. I tried the following
>> with both my system-wide install of clang (version 3.2) and the one I
>> built after my update yesterday:
>>
>>   [papin_g:~/GSoC/build]$ cat /tmp/gnu-unused.cpp
>>   struct AB {
>>     AB([[gnu::unused]] int i) {}
>>     void f([[gnu::unused]] int i) {} // no error for this line
>>   };
>>   [papin_g:~/GSoC/build]$ ./bin/clang++ -std=c++11 -fsyntax-only
>> /tmp/gnu-unused.cpp
>>   /tmp/gnu-unused.cpp:2:6: error: expected member name or ';' after
>> declaration specifiers
>>     AB([[gnu::unused]] int i) {}
>>     ~~ ^
>>   /tmp/gnu-unused.cpp:2:6: error: an attribute list cannot appear here
>>     AB([[gnu::unused]] int i) {}
>>        ^~~~~~~~~~~~~~~
>>   /tmp/gnu-unused.cpp:2:22: error: expected ')'
>>     AB([[gnu::unused]] int i) {}
>>                        ^
>>   /tmp/gnu-unused.cpp:2:5: note: to match this '('
>>     AB([[gnu::unused]] int i) {}
>>       ^
>>   3 errors generated.
>>
>>
>> I will update Clang tomorrow and see if the problem persists. Maybe it's
>> only me and I checked out at the wrong time or it's has been fixed since
>> yesterday.
>
>
> This was a bug in our disambiguation of constructor / non-constructor
> declarations. Fixed in r190111, thanks.
>
>>
>> Aaron Ballman <aaron at aaronballman.com> writes:
>>
>> > On Thu, Sep 5, 2013 at 11:49 AM, Guillaume Papin
>> > <guillaume.papin at epitech.eu> wrote:
>> >> Hi,
>> >>
>> >> While testing some code with attributes I found the following that
>> >> looks
>> >> like a bug to me:
>> >>
>> >>   $ clang-check /tmp/unused.cpp -- -std=c++11
>> >>
>> >>   struct AB {
>> >>     AB([[gnu::unused]] int i) {}
>> >>     // ^~~~~~~~~~~~~~~ /tmp/unused.cpp:2:5: error: an attribute list
>> >> cannot appear here
>> >>
>> >>     void f([[gnu::unused]] int i) {} // no error for this line
>> >>   };
>> >>
>> >> Do constructors have different parameter-declaration-list than member
>> >> functions?
>> >
>> > They do not -- are you using ToT?  I get no errors with your code on a
>> > relatively recent build.
>> >
>> > ~Aaron
>> >
>>
>> --
>> Guillaume Papin
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>



More information about the cfe-dev mailing list