Skip to content

Commit 90865cc

Browse files
committed
Update json.cc
source updates to compile with msvc
1 parent 49b5ec6 commit 90865cc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/json.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ int json::get() const
414414
switch (type_)
415415
{
416416
case (value_t::number):
417-
return value_.number;
417+
return static_cast<int>(value_.number);
418418
case (value_t::number_float):
419419
return static_cast<int>(value_.number_float);
420420
default:
@@ -2371,7 +2371,7 @@ std::string json::parser::codePointToUTF8(unsigned int codePoint) const
23712371
{
23722372
// Can't be tested without direct access to this private method.
23732373
std::string errorMessage = "Invalid codePoint: ";
2374-
errorMessage += codePoint;
2374+
errorMessage += static_cast<char>(codePoint);
23752375
error(errorMessage);
23762376
}
23772377
}
@@ -2584,6 +2584,8 @@ void json::parser::expect(const char c)
25842584

25852585
}
25862586

2587+
2588+
#if !_MSC_VER
25872589
/*!
25882590
This operator implements a user-defined string literal for JSON objects. It can
25892591
be used by adding \p "_json" to a string literal and returns a JSON object if
@@ -2596,3 +2598,4 @@ nlohmann::json operator "" _json(const char* s, std::size_t)
25962598
{
25972599
return nlohmann::json::parse(s);
25982600
}
2601+
#endif

0 commit comments

Comments
 (0)