Bug 15138 – [REG2.068.2] ICE with basic use of stdx.data.json
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-10-02T15:07:00Z
Last change time
2015-10-07T02:56:33Z
Keywords
ice, pull
Assigned to
nobody
Creator
monkeyworks12
Comments
Comment #0 by monkeyworks12 — 2015-10-02T15:07:57Z
The following code:
import stdx.data.json;
void main()
{
string str = `{"a": true, "b": "test"}`;
auto v = parseJSONValue(str);
// The following line causes the problem in 2.068.2
auto obj = v.get!(JSONValue[string]);
}
Fails to compile with the following error:
Assertion failure: 'minst->isRoot() || minst->rootImports()' on line 8013 in file 'template.c'
stdx.data.json can be found here:
https://github.com/s-ludwig/std_data_json
Comment #1 by monkeyworks12 — 2015-10-02T15:08:23Z
This is using DMD 2.068.2. The code reportedly works with 2.068.1.
Comment #2 by schuetzm — 2015-10-02T18:56:30Z
Which exact command line and directory layout are you using? I cannot reproduce this currently with any of 2.068.1, 2.068.2 or master.
Comment #3 by monkeyworks12 — 2015-10-02T19:55:10Z
Just basic Windows cmd.exe, using Dub to build the program. My directory layout is the standard Dub layout. A top-level project folder containing dub.json et al., as well as a `source` directory containing app.d with the offending code. Navigating to that folder and typing `dub` to run the build process is enough to produce the error.
(In reply to Martin Nowak from comment #5)
> Can anyone try to reduce this using dustmite?
Reduced case:
// app.d
import json;
void main()
{
JSONValue v;
v.get!JSONValue;
}
// json.d
alias AliasSeq(TL...) = TL;
alias FieldNameTuple(T...) = AliasSeq!();
struct TaggedAlgebraic(U)
{
alias X = FieldNameTuple!(U.tupleof);
}
void get(T, U)(TaggedAlgebraic!U ta) {}
union PayloadUnion
{
int dummy;
}
struct JSONValue
{
alias Payload = TaggedAlgebraic!PayloadUnion;
void get(T)()
{
Payload payload;
.get!T(payload);
}
}
// command line:
dmd -unittest app.d
DMD v2.069 DEBUG
[email protected](6385): Assertion failure
----------------
0x0059CBC7 in _d_assert
0x0045BB98 in TemplateInstance at c:\d2home\dmd2\src\dmd\src\dtemplate.d(6386)
0x005127AD in ToObjFile at c:\d2home\dmd2\src\dmd\src\toobj.c(1138)
0x0045E1B9 in TemplateInstance at c:\d2home\dmd2\src\dmd\src\dtemplate.d(7597)
0x00510A10 in toObjFile at c:\d2home\dmd2\src\dmd\src\toobj.c(1204)
0x005075FB in genObjFile at c:\d2home\dmd2\src\dmd\src\glue.c(385)
0x004ADD86 in tryMain at c:\d2home\dmd2\src\dmd\src\mars.d(1621)
0x004AE1AB in _Dmain at c:\d2home\dmd2\src\dmd\src\mars.d(1695)
0x0059DDBA in D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv
0x0059DD8F in void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll()
0x0059DCA7 in _d_run_main
0x004AE4F0 in main
0x005B21BD in mainCRTStartup
0x75A8336A in BaseThreadInitThunk
0x776B9882 in RtlInitializeExceptionChain
0x776B9855 in RtlInitializeExceptionChain