Skip to content

would you like to support gcc 4.8.1?  #211

Closed

Description

@abc100m

our machine which installed centos has gcc 4.8.1 installed, and it's hardly to upgrade to gcc 4.9. so, would you like to have a work round to support for gcc 4.8.1?

for example, work round for bug 55817 of gcc 4.8 :

/*
        result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, ilist);
*/
        #if __GNUC__ == 4 && __GNUC_MINOR__ == 8
            auto insert_pos = std::distance(m_value.array->begin(), pos.m_it.array_iterator);
            m_value.array->insert(pos.m_it.array_iterator, ilist);
            result.m_it.array_iterator = m_value.array->begin() + insert_pos;
        #else
            result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, ilist);
        #endif

Activity

  1. alestrooisma commented on Mar 9, 2016

    @alestrooisma

    I am currently using this library with gcc 4.8.2, and so far I have not encountered any issues.
    What features would cause problems?

  2. abc100m commented on Mar 23, 2016

    @abc100m
    Author

    @alestrooisma you need build this library and run the provided test case, and then you will see which case will be failed

  3. zenfey commented on Mar 24, 2016

    @zenfey

    make command for json_unit with gcc 4.8.4 leads to error below. am I missing something?

    g++ -std=c++11 -Wall -Wextra -pedantic -Weffc++ -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-declarations -Wmissing-include-dirs -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-overflow=5 -Wswitch -Wundef -Wno-unused -Wnon-virtual-dtor -Wreorder -Wdeprecated -Wfloat-equal -I src -I test test/unit.cpp -o json_unit
    test/unit.cpp:11899:32: error: unterminated raw string
    CHECK_NOTHROW(json(R"(
    ^
    test/unit.cpp:11914:14: warning: missing terminating " character [enabled by default]
    )"));
    ^
    test/unit.cpp:11918:32: error: unterminated raw string
    CHECK_NOTHROW(json(R"(
    ^
    test/unit.cpp:11940:15: warning: missing terminating " character [enabled by default]
    ])"));
    ^
    test/unit.cpp:12105:30: error: unterminated raw string
    const auto content = R"(
    ^
    test/unit.cpp:12110:11: warning: missing terminating " character [enabled by default]
    })";
    ^
    test/unit.cpp:12349:0: error: unterminated argument list invoking macro "CHECK_NOTHROW"

    ^
    In file included from test/unit.cpp:26:0:
    src/json.hpp: In instantiation of ‘class nlohmann::basic_json<>::const_iterator’:
    src/json.hpp:6813:11: required from ‘class nlohmann::basic_json<>::iterator’
    test/unit.cpp:953:24: required from here
    src/json.hpp:6269:11: warning: base class ‘struct std::iterator<std::random_access_iterator_tag, const nlohmann::basic_json<>, long int, const nlohmann::basic_json<>, const nlohmann::basic_json<>&>’ has a non-virtual destructor [-Weffc++]
    class const_iterator : public std::iterator<std::random_access_iterator_tag, const basic_json>
    ^
    src/json.hpp: In instantiation of ‘class nlohmann::basic_json<>::iterator’:
    test/unit.cpp:953:24: required from here
    src/json.hpp:6813:11: warning: base class ‘class nlohmann::basic_json<>::const_iterator’ has a non-virtual destructor [-Weffc++]
    class iterator : public const_iterator
    ^
    src/json.hpp: In instantiation of ‘class nlohmann::basic_json<>::json_reverse_iteratornlohmann::basic_json<::iterator>’:
    test/unit.cpp:4987:40: required from here
    src/json.hpp:6954:11: warning: base class ‘class std::reverse_iteratornlohmann::basic_json<::iterator>’ has a non-virtual destructor [-Weffc++]
    class json_reverse_iterator : public std::reverse_iterator
    ^
    src/json.hpp: In instantiation of ‘class nlohmann::basic_json<>::json_reverse_iteratornlohmann::basic_json<::const_iterator>’:
    test/unit.cpp:5012:46: required from here
    src/json.hpp:6954:11: warning: base class ‘class std::reverse_iteratornlohmann::basic_json<::const_iterator>’ has a non-virtual destructor [-Weffc++]
    test/unit.cpp: In function ‘void C_A_T_C_H____T_E_S_T____11880()’:
    test/unit.cpp:11899:13: error: ‘CHECK_NOTHROW’ was not declared in this scope
    CHECK_NOTHROW(json(R"(
    ^
    test/unit.cpp:11899:13: error: expected ‘;’ at end of input
    test/unit.cpp:11899:13: error: expected ‘}’ at end of input
    test/unit.cpp:11899:13: error: expected ‘}’ at end of input
    test/unit.cpp:11899:13: error: expected ‘}’ at end of input
    In file included from test/unit.cpp:26:0:
    src/json.hpp: In instantiation of ‘nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType>::iterator nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType>::insert(nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType>::const_iterator, nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType>::size_type, const nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType>&) [with ObjectType = std::map; ArrayType = std::vector; StringType = std::basic_string; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType>::size_type = long unsigned int]’:
    test/unit.cpp:8072:63: required from here
    src/json.hpp:4876:40: error: no match for ‘operator=’ (operand types are ‘std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > >::iterator {aka __gnu_cxx::__normal_iteratornlohmann::basic_json<
    , std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >}’ and ‘void’)
    result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, cnt, val);
    ^
    src/json.hpp:4876:40: note: candidates are:
    In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
    from /usr/include/c++/4.8/bits/char_traits.h:39,
    from /usr/include/c++/4.8/ios:40,
    from /usr/include/c++/4.8/istream:38,
    from /usr/include/c++/4.8/sstream:38,
    from test/catch.hpp:70,
    from test/unit.cpp:12:
    /usr/include/c++/4.8/bits/stl_iterator.h:708:11: note: __gnu_cxx::__normal_iteratornlohmann::basic_json<
    , std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >& __gnu_cxx::__normal_iteratornlohmann::basic_json<
    , std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >::operator=(const __gnu_cxx::__normal_iteratornlohmann::basic_json<
    , std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >&)
    class __normal_iterator
    ^
    /usr/include/c++/4.8/bits/stl_iterator.h:708:11: note: no known conversion for argument 1 from ‘void’ to ‘const __gnu_cxx::__normal_iteratornlohmann::basic_json<
    , std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >&’
    /usr/include/c++/4.8/bits/stl_iterator.h:708:11: note: __gnu_cxx::__normal_iteratornlohmann::basic_json<, std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >& __gnu_cxx::__normal_iteratornlohmann::basic_json<, std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >::operator=(__gnu_cxx::__normal_iteratornlohmann::basic_json<, std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >&&)
    /usr/include/c++/4.8/bits/stl_iterator.h:708:11: note: no known conversion for argument 1 from ‘void’ to ‘__gnu_cxx::__normal_iteratornlohmann::basic_json<
    , std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >&&’
    In file included from test/unit.cpp:26:0:
    src/json.hpp: In instantiation of ‘nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType>::iterator nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType>::insert(nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType>::const_iterator, nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType>::const_iterator, nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType>::const_iterator) [with ObjectType = std::map; ArrayType = std::vector; StringType = std::basic_string; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator]’:
    test/unit.cpp:8113:99: required from here
    src/json.hpp:4942:36: error: no match for ‘operator=’ (operand types are ‘std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > >::iterator {aka __gnu_cxx::__normal_iteratornlohmann::basic_json<, std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >}’ and ‘void’)
    result.m_it.array_iterator = m_value.array->insert(
    ^
    src/json.hpp:4942:36: note: candidates are:
    In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
    from /usr/include/c++/4.8/bits/char_traits.h:39,
    from /usr/include/c++/4.8/ios:40,
    from /usr/include/c++/4.8/istream:38,
    from /usr/include/c++/4.8/sstream:38,
    from test/catch.hpp:70,
    from test/unit.cpp:12:
    /usr/include/c++/4.8/bits/stl_iterator.h:708:11: note: __gnu_cxx::__normal_iteratornlohmann::basic_json<
    , std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >& __gnu_cxx::__normal_iteratornlohmann::basic_json<, std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >::operator=(const __gnu_cxx::__normal_iteratornlohmann::basic_json<, std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >&)
    class __normal_iterator
    ^
    /usr/include/c++/4.8/bits/stl_iterator.h:708:11: note: no known conversion for argument 1 from ‘void’ to ‘const __gnu_cxx::__normal_iteratornlohmann::basic_json<, std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >&’
    /usr/include/c++/4.8/bits/stl_iterator.h:708:11: note: __gnu_cxx::__normal_iteratornlohmann::basic_json<
    , std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >& __gnu_cxx::__normal_iteratornlohmann::basic_json<, std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >::operator=(__gnu_cxx::__normal_iteratornlohmann::basic_json<, std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >&&)
    /usr/include/c++/4.8/bits/stl_iterator.h:708:11: note: no known conversion for argument 1 from ‘void’ to ‘__gnu_cxx::__normal_iteratornlohmann::basic_json<, std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >&&’
    In file included from test/unit.cpp:26:0:
    src/json.hpp: In instantiation of ‘nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType>::iterator nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType>::insert(nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType>::const_iterator, std::initializer_list<nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType> >) [with ObjectType = std::map; ArrayType = std::vector; StringType = std::basic_string; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator]’:
    test/unit.cpp:8147:68: required from here
    src/json.hpp:4990:36: error: no match for ‘operator=’ (operand types are ‘std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > >::iterator {aka __gnu_cxx::__normal_iteratornlohmann::basic_json<
    , std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >}’ and ‘void’)
    result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, ilist);
    ^
    src/json.hpp:4990:36: note: candidates are:
    In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
    from /usr/include/c++/4.8/bits/char_traits.h:39,
    from /usr/include/c++/4.8/ios:40,
    from /usr/include/c++/4.8/istream:38,
    from /usr/include/c++/4.8/sstream:38,
    from test/catch.hpp:70,
    from test/unit.cpp:12:
    /usr/include/c++/4.8/bits/stl_iterator.h:708:11: note: __gnu_cxx::__normal_iteratornlohmann::basic_json<, std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >& __gnu_cxx::__normal_iteratornlohmann::basic_json<, std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >::operator=(const __gnu_cxx::__normal_iteratornlohmann::basic_json<, std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >&)
    class __normal_iterator
    ^
    /usr/include/c++/4.8/bits/stl_iterator.h:708:11: note: no known conversion for argument 1 from ‘void’ to ‘const __gnu_cxx::__normal_iteratornlohmann::basic_json<
    , std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >&’
    /usr/include/c++/4.8/bits/stl_iterator.h:708:11: note: __gnu_cxx::__normal_iteratornlohmann::basic_json<, std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >& __gnu_cxx::__normal_iteratornlohmann::basic_json<, std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >::operator=(__gnu_cxx::__normal_iteratornlohmann::basic_json<, std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >&&)
    /usr/include/c++/4.8/bits/stl_iterator.h:708:11: note: no known conversion for argument 1 from ‘void’ to ‘__gnu_cxx::__normal_iteratornlohmann::basic_json<
    , std::vectornlohmann::basic_json<, std::allocatornlohmann::basic_json< > > >&&’
    make: *** [json_unit] Error 1

  4. alestrooisma commented on Mar 25, 2016

    @alestrooisma

    Well, that seems to be this bug, which is mentioned in the readme as a reason why GCC 4.8 is not supported.

  5. added
    solution: wontfix
    and removed on Mar 30, 2016
  6. nlohmann commented on Mar 30, 2016

    @nlohmann
    Owner

    Closed. See comments in PR #212.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    solution: wontfix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions