From c9a02cbc59e9e0bc9bdab96c5ef2e030c79a21a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20DELRIEU?= Date: Tue, 5 Dec 2017 10:52:55 +0100 Subject: [PATCH] to/from_json: add a MSVC-specific static_assert to force a stacktrace --- src/json.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/json.hpp b/src/json.hpp index 9754e464..5b4bec8a 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -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; + static_assert(sizeof(typename decayed::force_msvc_stacktrace) == 0, + "forcing msvc stacktrace to show which T we're talking about."); +#endif } public: @@ -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; + static_assert(sizeof(typename decayed::force_msvc_stacktrace) == 0, + "forcing msvc stacktrace to show which T we're talking about."); +#endif } public: