Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

to/from_json: add a MSVC-specific static_assert to force a stacktrace #854

Merged
merged 1 commit into from
Dec 5, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1351,6 +1351,13 @@ struct to_json_fn
{
static_assert(sizeof(BasicJsonType) == 0,
"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:
Expand Down Expand Up @@ -1378,6 +1385,12 @@ struct from_json_fn
{
static_assert(sizeof(BasicJsonType) == 0,
"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:
Expand Down