Bug 16472 – Spurious "is used as a type" when aliasing enum template as default parameter

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-09-06T12:30:46Z
Last change time
2021-04-04T03:51:54Z
Keywords
pull
Assigned to
No Owner
Creator
Manu

Comments

Comment #0 by turkeyman — 2016-09-06T12:30:46Z
template E(F){ enum E { K = F(1) } } struct S(F = float, alias e_ = E!double.K) {} S!float x; // Error: E!double.K is used as a type alias T = E!double.K; struct S2(F = float, alias e_ = T) {} S2!float y; // alias makes it okay... struct S3(F = float, alias e_ = (E!double.K)) {} S3!float z; // just putting parens make it okay as well... wat!? This can't be right... right? No problem if E is not a template.
Comment #1 by nick — 2018-02-08T12:54:13Z
Reduced: enum e() = 0; template t(alias v = e!()) {} //Error alias dummy = t!(); No error if you define `t` without `alias`: template t(int v = e!()) {} //OK
Comment #2 by turkeyman — 2018-05-06T20:04:00Z
This has come up again... is annoying!
Comment #3 by dlang-bot — 2021-03-29T06:14:54Z
@thewilsonator created dlang/dmd pull request #12316 "Fix issue 16472: Spurious "is used as a type" when aliasing enum temp…" fixing this issue: - Fix issue 16472: Spurious "is used as a type" when aliasing enum template as default parameter https://github.com/dlang/dmd/pull/12316
Comment #4 by dlang-bot — 2021-04-04T03:51:54Z
dlang/dmd pull request #12316 "Fix issue 16472: Spurious "is used as a type" when aliasing enum temp…" was merged into master: - 860d161e4476ce7536e012d2baf4f5c3dc1f0581 by Nicholas Lindsay Wilson: Fix issue 16472: Spurious "is used as a type" when aliasing enum template as default parameter https://github.com/dlang/dmd/pull/12316