Repository navigation
internal compiler error (gcc7) #701
Description
After dealing with the "using namespace std", I receive the following error when compiling json.hpp
/media/ncrooks/Data/Documents/PhD/morty/src/util/json.hpp: In instantiation of ‘static nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::string_t nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::escape_string(const string_t&) [with ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::string_t = std::__cxx11::basic_string]’:
/media/ncrooks/Data/Documents/PhD/morty/src/util/json.hpp:8449:39: required from ‘void nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::dump(std::ostream&, bool, unsigned int, unsigned int) const [with ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; std::ostream = std::basic_ostream]’
/media/ncrooks/Data/Documents/PhD/morty/src/util/json.hpp:2653:17: required from ‘nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::string_t nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::dump(int) const [with ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::string_t = std::__cxx11::basic_string]’
/media/ncrooks/Data/Documents/PhD/morty/src/util/json.hpp:12951:25: required from here
/media/ncrooks/Data/Documents/PhD/morty/src/util/json.hpp:8228:25: internal compiler error: in type_unification_real, at cp/pt.c:19128
for (const char m :
^~~
0x5f8748 type_unification_real
../../src/gcc/cp/pt.c:19128
0x5dfcb3 do_auto_deduction(tree_node*, tree_node*, tree_node*, int, auto_deduction_context, tree_node*, int)
../../src/gcc/cp/pt.c:25417
0x5e0375 do_auto_deduction(tree_node*, tree_node*, tree_node*)
../../src/gcc/cp/pt.c:25309
0x6297a3 build_range_temp
../../src/gcc/cp/parser.c:11585
0x631485 cp_convert_range_for(tree_node*, tree_node*, tree_node*, tree_node*, unsigned int, bool)
../../src/gcc/cp/parser.c:11682
0x5e7364 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../src/gcc/cp/pt.c:15880
0x5e7bc5 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../src/gcc/cp/pt.c:15719
0x5e7a5b tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../src/gcc/cp/pt.c:15945
0x5e85d5 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../src/gcc/cp/pt.c:15915
0x5e7bc5 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../src/gcc/cp/pt.c:15719
0x5e7a5b tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../src/gcc/cp/pt.c:15945
0x5e7bc5 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../src/gcc/cp/pt.c:15719
0x5e7a5b tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../src/gcc/cp/pt.c:15945
0x5e7b3c tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../src/gcc/cp/pt.c:15965
0x5e737e tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../src/gcc/cp/pt.c:15882
0x5e7bc5 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../src/gcc/cp/pt.c:15719
0x5e7a5b tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../src/gcc/cp/pt.c:15945
0x5e61f2 instantiate_decl(tree_node*, bool, bool)
../../src/gcc/cp/pt.c:22897
0x5ff45b instantiate_pending_templates(int)
../../src/gcc/cp/pt.c:23018
0x61f250 c_parse_final_cleanups()
../../src/gcc/cp/decl2.c:4526
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
Activity
nlohmann commentedon Aug 16, 2017
The test suite compiles without problem with g++-7 (Ubuntu 7.1.0-5ubuntu2~14.04) 7.1.0, see https://travis-ci.org/nlohmann/json/jobs/265058071.
What OS are you using and which exact GCC version?
Can you provide the source code that yields this error?
nacrooks commentedon Aug 16, 2017
I have commented out most of the lines in which I actually use the library (other than the include, and the field declaration) to narrow down the problem. I use gcc-7 (Ubuntu 7.1.0-5ubuntu2~16.04) 7.1.0
theodelrieu commentedon Aug 16, 2017
I copy-pasted your snippet and it compiles with my GCC (Debian 7.1.0-13)
nlohmann commentedon Aug 16, 2017
I can compile the code with g++-7 (Homebrew GCC 7.2.0) 7.2.0.
nlohmann commentedon Aug 16, 2017
Thanks for reporting, but since I cannot reproduce the error, I cannot do much about it.