UDA on double nested struct

Basile B. b2.temp at gmx.com
Mon Aug 20 16:27:55 UTC 2018


On Monday, 20 August 2018 at 16:16:04 UTC, Sebastiaan Koppe wrote:
> Hey, I am trying to get UDAs from a doubly nested struct, to no 
> avail:
>
> code
> ---
> import std.traits : hasUDA;
> enum hover;
>
> struct Style {
>   struct Root {
>     auto margin = "10px";
>     auto backgroundColor = "white";
>     @hover struct Hover {
>       auto backgroundColor = "gray";
>     }
>   }
> }
> pragma(msg, hasUDA!(Style.Root.Hover, hover));
> ---
>
> returns false. Bug or no? (Yes, I am generating css at compile 
> time.)
>
> Putting it on Root or on Style works as intended;

Hello, it works fine here. Maybe there was another error that you 
removed when you have minimized the example. See 
https://run.dlang.io/is/ZrW7kI, that says that the example works 
since 2.068.2. Although that are are possibility that it was 
broken before a patch release, since only latest path of a minor 
release is tested on the site, in which case updating the 
compiler would fix the issue.


More information about the Digitalmars-d-learn mailing list