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

Weird template issue in large project #1162

Closed
JasonDictos opened this issue Jul 14, 2018 · 1 comment
Closed

Weird template issue in large project #1162

JasonDictos opened this issue Jul 14, 2018 · 1 comment

Comments

@JasonDictos
Copy link

JasonDictos commented Jul 14, 2018

So I've been integrating this amazing json library into a closed source project for some time, recently when I started using std::variant a bit, things started to go south on gcc 8.1.0. The same code compiles and works fine on visual studio 2017 (latest as of this writing).

The basic idea is I have a variant with various structures defined in it, each with their own overload for to_json/from_json calls.

When I try to use std::get<structure_name>(variant_member) I get an error:

error: exception specification of ‘nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::basic_json(CompatibleType&&) [with CompatibleType = const signalwire::client::blade::Netcast::RouteRemove&; U = signalwire::client::blade::Netcast::RouteRemove; typename std::enable_if<nlohmann::detail::is_compatible_type<nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>, U>::value, int>::type <anonymous> = 0; ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer]’ depends on itself

Note other uses with std::variant have worked in the past on same compiler/platform.

@JasonDictos
Copy link
Author

Ah, figured it out. I was using an alias for my variant type, then I was specializing the to_json with that definition. By removing that specialization, all is well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant