need help to check symbol is static variable or not

Nick Treleaven nick at geany.org
Mon Jul 15 11:16:23 UTC 2024


On Monday, 15 July 2024 at 06:44:12 UTC, Dakota wrote:
> ```d
> struct type_s
> {
>
>     union {
>         struct
>         {
>             int a;
>             int b;
>         } c;
>     };
> };
> ```
>
> `type c` will return false with `enum isStatic(alias V) = 
> __traits(compiles, { enum v = V; });`

I put `type_s` in a file anonstruct.c, then:
```d
import anonstruct;

pragma(msg, isStatic!(type_s.c));
```
That outputs `false`, because the symbol is not a compile-time 
value. Is that what you meant?


More information about the Digitalmars-d-learn mailing list