Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error with ICPC compiler #1068

Closed
stefashkaa opened this issue Apr 25, 2018 · 8 comments
Closed

Compilation error with ICPC compiler #1068

stefashkaa opened this issue Apr 25, 2018 · 8 comments
Labels
platform: icc related to Intel compiler state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated

Comments

@stefashkaa
Copy link

Hello!

What could you say about #994 issue?

I have a similar problem using the ICPC compiler.

...\json.hpp(904): error : type name is not allowed
detect(std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;
...\json.hpp(920): error : type name is not allowed
std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;
...\json.hpp(935): error : type name is not allowed
std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;

I use the following flags:
icpc -qopenmp -Wall -otarget/main-uname -m main.cpp
Could you help me?

Best regards!
Stefan

@nlohmann nlohmann added the platform: icc related to Intel compiler label Apr 25, 2018
@nlohmann
Copy link
Owner

Which version of the library are you using? Which compiler version are you using? Which program are you trying to compile?

@nlohmann nlohmann added the state: needs more info the author of the issue needs to provide more details label Apr 25, 2018
@stefashkaa
Copy link
Author

stefashkaa commented Apr 25, 2018

I'm using icpc from Intel Parallel Studio 16.4,
json version 3.0.1.
I try to compile simple code with json for my diploma work using REST API

@nlohmann
Copy link
Owner

Does the error still occur with 3.1.2? How does the program look like? What is the call to the library that fails?

@stefashkaa
Copy link
Author

Error is reproduced in 3.1.2, too.
For instance, I use json for request:

json auth = "{\"label\":\"wavelet\",\"username\":\"stefan\",\"password\":\"pass\"}"_json;
slist = curl_slist_append(slist, "Content-Type: application/json");
string response_string;
string header_string;
json token = getToken(curl, slist, auth);
if (token == NULL)
{
	cout << "Token wasn't loaded" << endl;
	return -1;
}

string token_str = token["access_token"];
cout << "Token: " << token_str << endl;

@nlohmann nlohmann removed the state: needs more info the author of the issue needs to provide more details label Apr 25, 2018
@stale
Copy link

stale bot commented May 25, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label May 25, 2018
@stale stale bot closed this as completed Jun 1, 2018
@dhaumann
Copy link

dhaumann commented Jul 4, 2018

@nlohmann I can reproduce this issue with the Intel compiler version 17.0 Update 4 on Windows, nlohmann json v3.1.2. The error I get is:

nlohmann/detail/meta.hpp(195): error : type name is not allowed
1>             detect(std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;
1>                                                                                     ^
1>
1>nlohmann/detail/meta.hpp(213): error : type name is not allowed
1>             std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;
1>                                                                              ^
1>
1>nlohmann/detail/meta.hpp(228): error : type name is not allowed
1>             std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;
1>                                                                              ^

The switch /Qstd=c++11 is set, so C++11 should be available. Any hints on what to do to get a solution? It seems others were able to resolve this somehow.

@dhaumann
Copy link

dhaumann commented Jul 5, 2018

@nlohmann Found the issue. The following code exists three times: in has_from_json, has_non_default_from_json, has_to_json.

static constexpr bool value = std::is_integral<decltype(
    detect(std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value;

All three instances lead the the compiler error in my previous comment. If we change this to

static constexpr bool value = std::is_integral<decltype(
    detect(std::declval<typename BasicJsonType::template json_serializer<T, void> >()))>::value;
                                                                                 ^

then it works. So we just need to insert a space to change '>>' to '> >'.

To me, this looks clearly like an Intel compiler bug when using >> in [nested?] templates, maybe mixed with decltype or declval.

@nlohmann
Copy link
Owner

nlohmann commented Jul 5, 2018

Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: icc related to Intel compiler state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated
Projects
None yet
Development

No branches or pull requests

3 participants