Skip to content

cassert error #1076

@sburnwal

Description

@sburnwal

Bug Report

  • What is the issue you have?
    I know you have mentioned that this json lib works great with gcc 4.9. However, my project is big and it uses gcc 4.8 which is not easy to migrate to 4.9. When I write a small program, it works great. I can test json sample programs as you have mentioned in documentation. However, I want to use it in my project that is gcc 4.8.2 based. I took off the gcc 9 check from json.hpp and compiled fine and ran some tests that was all fine. But once in my poroject, my build does not go through. It gives this error:
In file included from /usr/include/c++/4.8.2/cassert:43:0,
 from ../security/src/libjwt/include/jwt/json.hpp:34,

At line 34 in json.hpp: 
   32 #include <algorithm> // all_of, copy, fill, find, for_each, none_of, remove, reverse, transform
   33 #include <array>   // array
   34 #include <cassert> // assert
   35 #include <cctype>  // isdigit

../security/src/libjwt/include/jwt/json.hpp:6055:31:   required from ‘static nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::parse(IteratorType, IteratorType, nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::parser_callback_t) [with IteratorType = const char*; typename std::enable_if<std::is_base_of<std::random_access_iterator_tag, typename std::iterator_traits<_II1>::iterator_category>::value, int>::type <anonymous> = 0; ObjectType = std::map; ArrayType = std::vector; StringType = std::basic_string<char>; 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>::parser_callback_t = std::function<bool(int, nlohmann::basic_json<>::parse_event_t, nlohmann::basic_json<>&)>]’

../security/src/libjwt/include/jwt/json.hpp:11764:40:   required from here
../security/src/libjwt/include/jwt/json.hpp:1579:19: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: [-Werror]
     assert(object != nullptr);

  • Please describe the steps to reproduce the issue. Can you provide a small but working code example?
    Sorry, I cannot myself repro it but want to know if anyone has faced it and what is the likely way to get out of it ? Any hint would be helpful.

  • What is the expected behavior?
    Compilation should succeed.

  • And what is the actual behavior instead?
    Compilation error.

  • Which compiler and operating system are you using? Is it a supported compiler?

  • Did you use a released version of the library or the version from the develop branch?

  • If you experience a compilation error: can you compile and run the unit tests?

Metadata

Metadata

Assignees

No one assigned

    Labels

    solution: wontfixthe issue will not be fixed (either it is impossible or deemed out of scope)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions