[cfe-dev] Attribute on constructor parameter rejected

Aaron Ballman aaron at aaronballman.com
Thu Sep 5 12:34:10 PDT 2013


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



More information about the cfe-dev mailing list