[cfe-dev] Enum parameters for a C++11 Attribute
Aaron Ballman
aaron at aaronballman.com
Fri Dec 19 08:43:05 PST 2014
On Fri, Dec 19, 2014 at 11:14 AM, LUIS MIGUEL SANCHEZ GARCIA
<luismiguel.sanchez at uc3m.es> wrote:
> When I compile this sample:
>
> int main()
> {
> int a = 5;
> int b = 6;
> [[own::myattr(RED)]]
> auto j5 = 2*a ;
> return 0;
> }
>
> I have the following message:
>
> $ clang++ test03.cpp -std=c++11 -Xclang -ast-dump -fsyntax-only
> test03.cpp:7:19: error: use of undeclared identifier 'RED'
> [[own::myattr(RED)]]
> ^
> Using:
> def OWNMyattr : Attr {
> let Spellings = [CXX11<"own", "myattr">];
> let Args = [VariadicEnumArgument<"Color", "ColorType",
> ["RED", "BLUE","GREEN"],
> ["RED", "BLUE","GREEN"]>];
> let Documentation = [Undocumented];
> }
>
> However if I use "RED" instead RED, It compiles.
Hmmm, it seems that variadic enum arguments are strings only, which is
inconsistent with enum arguments which can be strings or identifiers.
I believe that's an an oversight, and have fixed it in r224582.
~Aaron
More information about the cfe-dev
mailing list