mirror of
https://github.com/nlohmann/json.git
synced 2025-11-24 03:44:06 +08:00
Fix weak-vtables warning (#4500)
* 🔧 remove warning suppression * 🚨 fix weak-vtables warning #4087 * 🚨 suppress -Wweak-vtables warning * 🚨 suppress -Wweak-vtables warning * ✅ fix test * ✅ fix test * ✅ fix test
This commit is contained in:
@@ -25,6 +25,18 @@
|
||||
#include <nlohmann/detail/meta/type_traits.hpp>
|
||||
#include <nlohmann/detail/string_concat.hpp>
|
||||
|
||||
// With -Wweak-vtables, Clang will complain about the exception classes as they
|
||||
// have no out-of-line virtual method definitions and their vtable will be
|
||||
// emitted in every translation unit. This issue cannot be fixed with a
|
||||
// header-only library as there is no implementation file to move these
|
||||
// functions to. As a result, we suppress this warning here to avoid client
|
||||
// code to stumble over this. See https://github.com/nlohmann/json/issues/4087
|
||||
// for a discussion.
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wweak-vtables"
|
||||
#endif
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
namespace detail
|
||||
{
|
||||
@@ -255,3 +267,7 @@ class other_error : public exception
|
||||
|
||||
} // namespace detail
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user