Open janwilmans opened 1 year ago
https://godbolt.org/z/jnxMe6veT
workaround: -DJSON_HAS_RANGES=0
na.
no compilation error vs. compilation error
#include <nlohmann/json.hpp> #include <sstream> #include <iomanip> using nlohmann::json; int main() { std::stringstream ss; json j = {"foo", 1, 2, 3, false, {{"one", 1}}}; ss << std::setw(1) << std::setfill('\t') << j; }
In file included from <source>:1: In file included from /opt/compiler-explorer/libs/nlohmann_json/trunk/single_include/nlohmann/json.hpp:5097: /opt/compiler-explorer/gcc-13.1.0/lib/gcc/x86_64-linux-gnu/13.1.0/../../../../include/c++/13.1.0/ranges:6151:14: error: requires clause differs in template redeclaration requires forward_range<_Vp> ^ /opt/compiler-explorer/gcc-13.1.0/lib/gcc/x86_64-linux-gnu/13.1.0/../../../../include/c++/13.1.0/ranges:5850:14: note: previous template declaration is here requires input_range<_Vp> ^ /opt/compiler-explorer/gcc-13.1.0/lib/gcc/x86_64-linux-gnu/13.1.0/../../../../include/c++/13.1.0/ranges:8846:20: error: type-id cannot have a name { return (auto(__x) += __y); } ^ /opt/compiler-explorer/gcc-13.1.0/lib/gcc/x86_64-linux-gnu/13.1.0/../../../../include/c++/13.1.0/ranges:8846:25: error: expected ')' { return (auto(__x) += __y); } ^ /opt/compiler-explorer/gcc-13.1.0/lib/gcc/x86_64-linux-gnu/13.1.0/../../../../include/c++/13.1.0/ranges:8846:14: note: to match this '(' { return (auto(__x) += __y); } ^ /opt/compiler-explorer/gcc-13.1.0/lib/gcc/x86_64-linux-gnu/13.1.0/../../../../include/c++/13.1.0/ranges:8846:32: error: expected expression { return (auto(__x) += __y); } ^ 4 errors generated. ASM generation compiler returned: 1 In file included from <source>:1: In file included from /opt/compiler-explorer/libs/nlohmann_json/trunk/single_include/nlohmann/json.hpp:5097: /opt/compiler-explorer/gcc-13.1.0/lib/gcc/x86_64-linux-gnu/13.1.0/../../../../include/c++/13.1.0/ranges:6151:14: error: requires clause differs in template redeclaration requires forward_range<_Vp> ^ /opt/compiler-explorer/gcc-13.1.0/lib/gcc/x86_64-linux-gnu/13.1.0/../../../../include/c++/13.1.0/ranges:5850:14: note: previous template declaration is here requires input_range<_Vp> ^ /opt/compiler-explorer/gcc-13.1.0/lib/gcc/x86_64-linux-gnu/13.1.0/../../../../include/c++/13.1.0/ranges:8846:20: error: type-id cannot have a name { return (auto(__x) += __y); } ^ /opt/compiler-explorer/gcc-13.1.0/lib/gcc/x86_64-linux-gnu/13.1.0/../../../../include/c++/13.1.0/ranges:8846:25: error: expected ')' { return (auto(__x) += __y); } ^ /opt/compiler-explorer/gcc-13.1.0/lib/gcc/x86_64-linux-gnu/13.1.0/../../../../include/c++/13.1.0/ranges:8846:14: note: to match this '(' { return (auto(__x) += __y); } ^ /opt/compiler-explorer/gcc-13.1.0/lib/gcc/x86_64-linux-gnu/13.1.0/../../../../include/c++/13.1.0/ranges:8846:32: error: expected expression { return (auto(__x) += __y); } ^ 4 errors generated. Execution build compiler returned: 1
Linux, clang-16.0.5+gcc-13.1 standard library
3.11.2
develop
Description
https://godbolt.org/z/jnxMe6veT
workaround: -DJSON_HAS_RANGES=0
Reproduction steps
na.
Expected vs. actual results
no compilation error vs. compilation error
Minimal code example
Error messages
Compiler and operating system
Linux, clang-16.0.5+gcc-13.1 standard library
Library version
3.11.2
Validation
develop
branch is used.