Unverified Commit 0e3a0b73 authored by Niels Lohmann's avatar Niels Lohmann Committed by GitHub

Merge pull request #854 from theodelrieu/fix/force_msvc_stacktrace

to/from_json: add a MSVC-specific static_assert to force a stacktrace
parents f4c01601 c9a02cbc
...@@ -1351,6 +1351,13 @@ struct to_json_fn ...@@ -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 ...@@ -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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment