www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22969] New: Can't mixin name of manifest constant on

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

          Issue ID: 22969
           Summary: Can't mixin name of manifest constant on right-hand
                    side of alias declaration
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: snarwin+bugzilla gmail.com

As of DMD 2.099.0, the following program fails to compile:

---
enum e = 0;
alias a = mixin("e");
---

The error message is:

---
onlineapp.d(2): Error: alias `onlineapp.a` cannot alias an expression `0`
---

If the manifest constant is changed to a variable, compilation succeeds:

---
auto v = 0;
alias a = mixin("v"); // ok
---

--
Apr 02 2022