Bug 7990 – Assertion failure in std.variant

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-04-26T10:54:00Z
Last change time
2012-11-17T17:04:02Z
Assigned to
nobody
Creator
robert

Comments

Comment #0 by robert — 2012-04-26T10:54:21Z
The following code: ---- module test; import std.variant; import std.stdio; void main(string[] args) { auto i = Variant(3); if (i < "4") writefln("true"); } ---- Results in the following assertion failure when using dmd 2.059: $ rdmd test.d [email protected](788): Assertion failure ---------------- 5 test.d.42E9FB02844A66B138F2739733903C5F 0x0000000106d15536 _d_assertm + 42 6 test.d.42E9FB02844A66B138F2739733903C5F 0x0000000106d22ae3 void std.variant.__assert(int) + 23 7 test.d.42E9FB02844A66B138F2739733903C5F 0x0000000106d032c9 int std.variant.VariantN!(32uL).VariantN.opCmp!(immutable(char)[]).opCmp(immutable(char)[]) + 225 8 test.d.42E9FB02844A66B138F2739733903C5F 0x0000000106cfde2c _Dmain + 64 9 test.d.42E9FB02844A66B138F2739733903C5F 0x0000000106d15ea9 extern (C) int rt.dmain2.main(int, char**).void runMain() + 29 10 test.d.42E9FB02844A66B138F2739733903C5F 0x0000000106d1585e extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate()) + 38 11 test.d.42E9FB02844A66B138F2739733903C5F 0x0000000106d15ef6 extern (C) int rt.dmain2.main(int, char**).void runAll() + 58 12 test.d.42E9FB02844A66B138F2739733903C5F 0x0000000106d1585e extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate()) + 38 13 test.d.42E9FB02844A66B138F2739733903C5F 0x0000000106d157e9 main + 237 14 test.d.42E9FB02844A66B138F2739733903C5F 0x0000000106cfdde4 start + 52 15 ??? 0x0000000000000001 0x0 + 1 ----------------
Comment #1 by github-bugzilla — 2012-11-17T17:02:19Z
Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/0d05bfb615bb20a83e5e6c0edce41009c350a6a0 Fix Variant comparison ops (fixes issue 7990). Note that ptrdiff_t.min is used as a sentinel value in opCmp; seems like this was an oversight during the 64 bit mass migration in 8331c709.