[Issue 20905] Type definition inside a static if results in an undefined identifier

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Nov 8 19:39:01 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=20905

foerdi <dlang at foerdi.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dlang at foerdi.net

--- Comment #3 from foerdi <dlang at foerdi.net> ---
It seems that this depends on the definition order.

A reduced example:
```
struct Foo {
    my_type index;  
}

static if(true) {
    alias my_type = int;
}
```
Error: undefined identifier my_type

This example works:
```
static if(true) {
    alias my_type = int;
}

struct Foo {
    my_type index;  
}
```

--


More information about the Digitalmars-d-bugs mailing list