nlohmann / json

JSON for Modern C++
https://json.nlohmann.me
MIT License
41.46k stars 6.59k forks source link

c89 and c11 compile problem on HPE NonStop platform #4079

Open Watchman58 opened 12 months ago

Watchman58 commented 12 months ago

Description

I am using the nlohmann/json version 3.10.5 toolkit on this platform to build a new product with HPE's ported GNU C++ compiler. I have tried with both the c89 and c11 compilers so that is STL version 3 and 4 respectively. The NonStop Guardian operating system has an SVR4 compliant UNIX shell called OSS, that is layered on top of Guardian, and the compiler runs in this environment. It is conceptually similar to zOS, layered on top of IBM mainframe MVS. There are a huge number of applications and open source frameworks that have been successfully ported over to OSS over the last 3 decades so its pretty solid. FWIW, Boost v 1.56.0 is supported. I tried adding the -Wboost flag and it made no difference.

This is the first time I am using this framework. I don't fundamentally understand how to resolve this. Note that if you copy/paste the error message below into a document and change the font to courier new, the ^ indicator will line up with the symbol in error. I am building my app using PC-based cross compilers that are invoked from a vendor-customized version of Eclipse. Unix compatibility on the PC is via cygwin64 and it requires a custom version of nmake to build the eclipse projects. there is no cmake or ctest so I couldn't verify the install that way.

Thanks in advance for the assist...

Dean

Reproduction steps

All I did was simply include the json library in a new program I am writing. Since you would not likely have access to this mainframe, I propose arranging a mutually convenient time to do a Zoom session to demonstrate the problem. Email me at demalone@caleb-ltd.com with your phone number and I will give you a call.

Expected vs. actual results

I expect that just including the json file would not cause compile errors.

Minimal code example

For what it is worth, here are the include files I use, in order:

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <iostream>
#include <map>
#include <string>
using namespace std;
#include "nlohmann/json.hpp"
#include "zsysc.h"
using json=nlohmann::json;
#include <ktdmtyp.h>
extern "C"
{
#include <cextdecs.h>
}

Error messages

I am getting the following compile errors on std::declval:

make all
Building file: ../source/ANCREATE.cpp
Invoking: C++ Compiler (TNS/X)
c11 -Wcplusplus -I"C:\Program Files (x86)\HPE NonStop\L21.06\usr\include" -I"D:\workspace-e2s\e2mxDll\include" -g -O0 -Wsystype=guardian -Wcall_shared -c -o "source/ANCREATE.o" "../source/ANCREATE.cpp" &&
c11 -Wcplusplus -I"C:\Program Files (x86)\HPE NonStop\L21.06\usr\include" -I"D:\workspace-e2s\e2mxDll\include" -g -O0 -Wsystype=guardian -Wcall_shared -c -WM "../source/ANCREATE.cpp" | grep -v -e 'C:\Program Files (x86)\HPE NonStop\L21.06\usr\include' -e 'ANCREATE.cpp' | sed -e 's/[ ].*ANCREATE\Debug\..// ..//g' >'source/ANCREATE.d'

auto get_ptr() noexcept -> ### decltype(std::declval<basic_json_t&>().get_impl_ptr(std::declval()))
^
"D:\workspace-e2s\e2mxDll\include\nlohmann/json.hpp", line 1537: error(163):
incomplete type is not allowed
detected during instantiation of class
"nlohmann::basic_json<std::map, std::vector, std::string,
bool, int64_t, uint64_t, double, std::allocator,
nlohmann::adl_serializer, std::vector<uint8_t,
std::allocator<uint8_t>>>" at line 4737

  constexpr auto get_ptr() const noexcept -> decltype(std::declval<const basic_json_t&>().get_impl_ptr(std::declval<PointerType>()))
                                                      ^
"D:\workspace-e2s\e2mxDll\include\nlohmann/json.hpp", line 1548: error(163):
incomplete type is not allowed
detected during instantiation of class
"nlohmann::basic_json<std::map, std::vector, std::string,
bool, int64_t, uint64_t, double, std::allocator,
nlohmann::adl_serializer, std::vector<uint8_t,
std::allocator<uint8_t>>>" at line 4737

  -> decltype(std::declval<const basic_json_t&>().template get_ptr<PointerType>())
              ^
"D:\workspace-e2s\e2mxDll\include\nlohmann/json.hpp", line 1702: error(163):
incomplete type is not allowed
detected during instantiation of class
"nlohmann::basic_json<std::map, std::vector, std::string,
bool, int64_t, uint64_t, double, std::allocator,
nlohmann::adl_serializer, std::vector<uint8_t,
std::allocator<uint8_t>>>" at line 4737

  -> decltype(std::declval<const basic_json_t&>().template get_impl<ValueType>(detail::priority_tag<4> {}))
              ^
"D:\workspace-e2s\e2mxDll\include\nlohmann/json.hpp", line 1738: error(163):
incomplete type is not allowed
detected during instantiation of class
"nlohmann::basic_json<std::map, std::vector, std::string,
bool, int64_t, uint64_t, double, std::allocator,
nlohmann::adl_serializer, std::vector<uint8_t,
std::allocator<uint8_t>>>" at line 4737

  auto get() noexcept -> decltype(std::declval<basic_json_t&>().template get_ptr<PointerType>())
                                  ^
"D:\workspace-e2s\e2mxDll\include\nlohmann/json.hpp", line 1777: error(163):
incomplete type is not allowed
detected during instantiation of class
"nlohmann::basic_json<std::map, std::vector, std::string,
bool, int64_t, uint64_t, double, std::allocator,
nlohmann::adl_serializer, std::vector<uint8_t,
std::allocator<uint8_t>>>" at line 4737

Compiler and operating system

Guardian L21.08 using c11 compiler. Uncertain what version of GCC it was derived from.

Library version

3.11.2

Validation

Watchman58 commented 12 months ago

Note: I initially tried the 3.10.5 code, but have since installed 3.11.2 and get the same result.