[Issue 20410] New: ReplaceTypeUnless replaces enums with their basetype
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Nov 21 12:11:29 UTC 2019
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 at puremagic.com
Reporter: mail at 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() {
}
---
--
More information about the Digitalmars-d-bugs
mailing list