Bug 22969 – Can't mixin name of manifest constant on right-hand side of alias declaration
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-04-02T19:53:04Z
Last change time
2022-04-08T06:59:55Z
Keywords
pull
Assigned to
No Owner
Creator
Paul Backus
Comments
Comment #0 by snarwin+bugzilla — 2022-04-02T19:53:04Z
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
---
Comment #1 by moonlightsentinel — 2022-04-02T23:16:20Z
2.088.1: Success and no output
Since 2.089.1: Failure with output: onlineapp.d(2): Error: alias `onlineapp.a` cannot alias an expression `0`
Comment #2 by moonlightsentinel — 2022-04-03T01:10:51Z
@BorisCarvajal created dlang/dmd pull request #13946 "Fix Issue 22969 - Can't mixin name of manifest constant on right-hand side of alias declaration" fixing this issue:
- Fix Issue 22969 - Can't mixin name of manifest constant on right-handside of alias declaration
Remove an unnecessary `typeToExpression` conversion call that forced `mixin` to
be resolved via expression semantic (expanding enum constants when it shouldn't).
This was a change I wanted to make some time ago but an early error somewhere
in the type semantic prevented me (fixed here).
Also a duplicated code in `traits.d` to handle mixins is removed (it was a copy
of `typesem.d:compileTypeMixin` function).
https://github.com/dlang/dmd/pull/13946
Comment #4 by dlang-bot — 2022-04-05T06:43:20Z
dlang/dmd pull request #13946 "Fix Issue 22969 - Can't mixin name of manifest constant on right-hand side of alias declaration" was merged into stable:
- 63e226e11764e04220b1a101e09a05d499e98a20 by Boris Carvajal:
Fix Issue 22969 - Can't mixin name of manifest constant on right-handside of alias declaration
Remove an unnecessary `typeToExpression` conversion call that forced `mixin` to
be resolved via expression semantic (expanding enum constants when it shouldn't).
This was a change I wanted to make some time ago but an early error somewhere
in the type semantic prevented me (fixed here).
Also a duplicated code in `traits.d` to handle mixins is removed (it was a copy
of `typesem.d:compileTypeMixin` function).
https://github.com/dlang/dmd/pull/13946
Comment #5 by dlang-bot — 2022-04-08T06:59:55Z
dlang/dmd pull request #13962 "merge stable" was merged into master:
- 3dd97695a3a17f3df5356bae96b11be0f0784d12 by Boris Carvajal:
Fix Issue 22969 - Can't mixin name of manifest constant on right-handside of alias declaration (#13946)
Remove an unnecessary `typeToExpression` conversion call that forced `mixin` to
be resolved via expression semantic (expanding enum constants when it shouldn't).
This was a change I wanted to make some time ago but an early error somewhere
in the type semantic prevented me (fixed here).
Also a duplicated code in `traits.d` to handle mixins is removed (it was a copy
of `typesem.d:compileTypeMixin` function).
https://github.com/dlang/dmd/pull/13962