alias and __VERSION__ condition doesn't play well
frame
frame86 at live.com
Tue Jan 18 04:42:45 UTC 2022
At the very top of my module I have this declaration:
```d
static if (__VERSION__ >= 2098)
{
alias Foo = TypeA;
}
else
{
alias Foo = TypeB;
}
```
No problem inside the module itself but this doesn't work when
imported from another module:
Error: undefined identifier `Foo`
While this workaround works:
```d
template getAlias()
{
static if (__VERSION__ >= 2098)
{
alias getAlias = TypeA;
}
else
{
alias getAlias = TypeB;
}
}
alias Foo = getAlias!();
```
Is there a reason for that?
More information about the Digitalmars-d-learn
mailing list