dlang-community / std_data_json

Phobos candidate JSON implementation.
25 stars 13 forks source link

Cannot cast a integer value to int #22

Closed forbjok closed 8 years ago

forbjok commented 8 years ago

After upgrading from v0.17.0 to v0.18.1, when trying to convert an integer JSONValue to an int, it causes an AssertError "Cannot cast a integer value to int" that seems to be coming from within taggedalgebraic.

The issue is easily reproducible with the following code:

import std.conv;
import std.stdio;
import stdx.data.json;

void main() {
    auto jv = "{ \"a\": 1234 }".toJSONValue;
    auto myInt = jv["a"].to!int;
}
s-ludwig commented 8 years ago

Fix is in taggedalgebraic 0.10.2: https://github.com/s-ludwig/taggedalgebraic/commit/a0415ed13c9751e90f1034afee02f2cb0cd86c7c