pokowaka/jwt-cpp

Your version of json.hpp does not compile with clang 4.0

mdr1384 opened this issue · 6 comments

Your "json.hpp" file is supposedly v2.1.1 from nlohmann/json but it has massive differences from the actual version. It almost looks like some kind of weird pre-processing was done on it. Anyway, there are many cases of std::numeric_limits<type>::(xxx)() which does not compile with clang 4.0. The original v2.1.1 json.hpp file has this std::numeric_limits<type>::xxx() which compiles fine.

Error with clang 4.0:

z.cc:5:44: error: expected unqualified-id
    std::cout << std::numeric_limits<int>::(max)() << std::endl;
                                           ^
z.cc:5:45: error: use of undeclared identifier 'max'; did you mean 'std::max'?

I was able to replace your version of the file with the unaltered one and get it to compile, but I am not sure what other mods you might have made that are necessary for correct operation (hopefully none -- in which case I suggest either including the unaltered version, or removing it and adding a dependency on nlohmann/json.)

It fails also with GCC 5.4 (Ubuntu 16.04) and GCC 7 (Ubuntu 17.10), with similar error.

It seems my last PR (5a267d1) did the preprocessor macro expansions escapes incorrectly, it should be (std::numeric_limits<size_t>::max) rather than std::numeric_limits<size_t>::(max). I should have noticed the difference when I brought up the reference change in nlohmann/json 3.0 (nlohmann/json@95474e4)

It is interesting that the Visual Studio C++ compiler treats the escapes differently than Clang and GCC though, it had not occurred to me that that might be the case, so when it was properly processed on my end I made the assumption all was golden.

FYI - we successfully removed your json.hpp file and added a dependency on the devel/nlohmann-json FreeBSD port and your library built fine and passed all self tests.

Still fails here too. Fix?

I should probably add a subtree dependency on the Json lib.

We now have a travis build for clang 5, which succeeds.