mirror of
https://github.com/nlohmann/json.git
synced 2026-05-16 03:05:23 +00:00
* Fix: Add GCC diagnostic pragmas for C++ modules support (issue #5103) Signed-off-by: hariomphulre <hariiomphullre@gmail.com> * Fix: GCC C++20 modules with __cplusplus >= 202002L check (#5103) Signed-off-by: hariomphulre <hariiomphullre@gmail.com> Signed-off-by: hariomphulre <hariiomphullre@gmail.com> * Fix: Remove indentation from nested preprocessor directives and disable astyle preprocessor indentation Signed-off-by: hariomphulre <hariiomphullre@gmail.com> * Update amalgamated files with correct preprocessor directive indentation Signed-off-by: hariomphulre <hariiomphullre@gmail.com> * Fix GCC build for issue #5103; refresh amalgamated header Signed-off-by: hariomphulre <hariiomphullre@gmail.com> --------- Signed-off-by: hariomphulre <hariiomphullre@gmail.com>
This commit is contained in:
@@ -8,6 +8,15 @@
|
||||
|
||||
module;
|
||||
|
||||
// GCC workaround for C++ modules support.
|
||||
// When using C++20 modules, some compilers (particularly GCC) may have issues
|
||||
// with template instantiations in the module preamble. If you encounter
|
||||
// "redefinition" errors when including nlohmann/json.hpp, try one of:
|
||||
// 1. Include nlohmann/json.hpp in your module preamble BEFORE other #includes
|
||||
// 2. Or use: import nlohmann.json; instead of #include <nlohmann/json.hpp>
|
||||
// 3. Or upgrade to a newer GCC version with better modules support.
|
||||
// See: https://github.com/nlohmann/json/issues/5103
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
export module nlohmann.json;
|
||||
@@ -41,10 +50,3 @@ namespace detail
|
||||
} // namespace detail
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
export namespace std
|
||||
{
|
||||
using std::hash;
|
||||
using std::less;
|
||||
using std::swap;
|
||||
} // namespace std
|
||||
|
||||
Reference in New Issue
Block a user