digitalmars.D.bugs - [Issue 20410] New: ReplaceTypeUnless replaces enums with their
- d-bugmail puremagic.com (32/32) Nov 21 2019 https://issues.dlang.org/show_bug.cgi?id=20410
https://issues.dlang.org/show_bug.cgi?id=20410 Issue ID: 20410 Summary: ReplaceTypeUnless replaces enums with their basetype Product: D Version: D2 Hardware: x86 OS: All Status: NEW Severity: major Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: mail skoppe.eu ReplaceTypeUnless (and probably ReplaceType) decay enums into their base types. This causes issues with e.g. the Sumtype library, which expects its template argument list to contain no duplicates. (internally sumtype uses ReplaceTypeUnless as well, thereby invalidating its own invariant.) --- import std.meta; import std.typecons; import std.traits; enum Enum : string { foo = "Bar" } alias seq = AliasSeq!(string, Nullable!string, Enum, Nullable!Enum); alias replaced = ReplaceTypeUnless!(isBoolean, int, uint, seq); pragma(msg, seq); // prints: (string, Nullable!string, Enum, Nullable!(Enum) pragma(msg, replaced); // prints: (string, Nullable!string, string, Nullable!string) void main() { } --- --
Nov 21 2019