Comment #0 by andrej.mitrovich — 2012-01-19T19:36:52Z
Two files:
test.d:
import std.file;
import jsonx;
void main() {
jsonDecode("bla");
}
jsonx.d:
import std.conv;
import std.variant;
T jsonDecode(T = Variant, R)(R input) {
auto val = jsonDecode_impl!T(input);
return val;
}
/* Decode anything -> Variant */
Variant jsonDecode_impl(T : Variant, R)(ref R input) {
Variant v;
v = jsonDecode_impl!real(input);
return v;
}
/* Decode JSON number -> D number */
T jsonDecode_impl(T, R)(ref R input) {
try return parse!T(input);
catch(ConvException e) throw new JsonException("ConvException: " ~ e.msg);
}
class JsonException : Exception {
this(string s) {
super(s);
}
}
dmd test.d json.x:
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\conv.d(2089): Error: function std.conv.parse!(real,string).parse compiler error, parameter 'p', bugzilla 2962?
Assertion failure: '0' on line 709 in file 'glue.c'
I get the same ICE and error using both d-json from http://github.com/gianm/d-json.git and Robert Jacques's new json library. Combine this with std.json's runtime access violations on seemingly correct code and I would almost label this as a blocker.
Comment #1 by andrej.mitrovich — 2012-01-19T19:38:18Z
Edit: Sorry for the missing module declarations that were left out.
Comment #2 by andrej.mitrovich — 2012-01-19T19:38:58Z
(In reply to comment #1)
> Edit: Sorry for the missing module declarations that were left out.
And `dmd test.d json.x` should be `dmd test.d json.d`
Comment #3 by andrej.mitrovich — 2012-02-02T12:31:54Z
Yes, most of the ICE(glue.c) bugs are duplicates of one another. AFAIK there are only 3 independent ones, and of those, one is a simple variation of the other.
*** This issue has been marked as a duplicate of issue 2962 ***