Issue 21171 - Undefined identifier when alias inside static if.
Summary: Undefined identifier when alias inside static if.
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 major
Assignee: No Owner
URL:
Keywords:
Depends on: 17883
Blocks:
  Show dependency treegraph
 
Reported: 2020-08-17 20:41 UTC by Iain Buclaw
Modified: 2022-12-17 10:38 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Iain Buclaw 2020-08-17 20:41:27 UTC
Reduced test.

globals.d
---
import identifier;

static if (0)
{
}
else
{
    alias Uint64 = ulong;
    alias Int64 = long;
}

alias sinteger_t = Int64;
alias uinteger_t = Uint64;



identifier.d
---
import globals;
struct Token
{
    union
    {
        sinteger_t intvalue;
        uinteger_t unsvalue;
    }
}
---
Comment 1 Iain Buclaw 2020-08-18 06:59:08 UTC
Don't even need to have it in two separate sources.

---
struct Token
{
    union
    {
        sinteger_t intvalue;
        uinteger_t unsvalue;
    }
}

static if (0)
{
}
else
{
    alias Uint64 = ulong;
    alias Int64 = long;
}

alias sinteger_t = Int64;
alias uinteger_t = Uint64;
Comment 2 Iain Buclaw 2020-08-18 07:03:10 UTC
I thought I recognized the problem.  It's likely a duplicate of issue 17883, which I encountered a few years back.