Bug 16083 – AliasSeq loses type of enums that have the same value
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-05-27T13:45:00Z
Last change time
2017-08-07T13:15:23Z
Assigned to
nobody
Creator
yazan.dabain
Comments
Comment #0 by yazan.dabain — 2016-05-27T13:45:03Z
import std.meta : AliasSeq;
enum A : string { a = "foo" }
enum B : string { b = "foo" }
alias AA = AliasSeq!(A.a);
alias BB = AliasSeq!(B.b);
static assert(is(typeof(AA[0]) == A));
static assert(is(typeof(BB[0]) == B)); // this fails
---------------------
The problem disappears by doing any of the following:
- Removing one of the static asserts makes the other one pass.
- Making the value of A.a not equal to B.b
Comment #1 by yazan.dabain — 2016-05-27T14:02:05Z
Clarification:
---------------
import std.meta : AliasSeq;
enum A : string { a = "foo" }
enum B : string { b = "foo" }
static assert(is(typeof(AliasSeq!(A.a)[0]) == A)); // AliasSeq(1)
static assert(is(typeof(AliasSeq!(B.b)[0]) == B)); // currently fails but removing the line with AliasSeq(1) makes this succeed.
Comment #2 by github-bugzilla — 2017-03-09T08:12:41Z