[Issue 16666] type inside 'static if' can't be used before import

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 27 17:24:25 UTC 2022


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

duser at neet.fi changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
                 CC|                            |duser at neet.fi
          Component|druntime                    |dmd
           Hardware|x86_64                      |All
            Summary|core.sys.posix.sys.types    |type inside 'static if'
                   |uses c_long without         |can't be used before import
                   |importing its definition    |
                 OS|Linux                       |All
           Severity|enhancement                 |normal

--- Comment #2 from duser at neet.fi ---
underlying issue seems to be this:

// main.d
my_long x;
import core_stdc_config;

// core_stdc_config.d
static if (1)
        alias my_long = long;
else
        alias my_long = long;

main.d(1): Error: undefined identifier `my_long`

error goes away if "my_long x;" is moved after the import, ": my_long" is added
to make it a selective import, or if the "static if" is removed

--


More information about the Digitalmars-d-bugs mailing list