to/from_json: add a MSVC-specific static_assert to force a stacktrace
This commit is contained in:
parent
f4c01601fa
commit
c9a02cbc59
1 changed files with 13 additions and 0 deletions
13
src/json.hpp
13
src/json.hpp
|
@ -1351,6 +1351,13 @@ struct to_json_fn
|
||||||
{
|
{
|
||||||
static_assert(sizeof(BasicJsonType) == 0,
|
static_assert(sizeof(BasicJsonType) == 0,
|
||||||
"could not find to_json() method in T's namespace");
|
"could not find to_json() method in T's namespace");
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
// Visual Studio does not show a stacktrace for the above assert.
|
||||||
|
using decayed = uncvref_t<T>;
|
||||||
|
static_assert(sizeof(typename decayed::force_msvc_stacktrace) == 0,
|
||||||
|
"forcing msvc stacktrace to show which T we're talking about.");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -1378,6 +1385,12 @@ struct from_json_fn
|
||||||
{
|
{
|
||||||
static_assert(sizeof(BasicJsonType) == 0,
|
static_assert(sizeof(BasicJsonType) == 0,
|
||||||
"could not find from_json() method in T's namespace");
|
"could not find from_json() method in T's namespace");
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
// Visual Studio does not show a stacktrace for the above assert.
|
||||||
|
using decayed = uncvref_t<T>;
|
||||||
|
static_assert(sizeof(typename decayed::force_msvc_stacktrace) == 0,
|
||||||
|
"forcing msvc stacktrace to show which T we're talking about.");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in a new issue