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

Fix for #1647 #1821

Merged
merged 5 commits into from
Nov 5, 2019
Merged

Fix for #1647 #1821

merged 5 commits into from
Nov 5, 2019

Conversation

AnthonyVH
Copy link
Contributor

This fixed #1647, which discusses a compile error when an enum is deserialized and a user-defined struct has a "non default constructible" from_json function defined for it.

The issue was a template instantiation with a const-qualifier on the type. This pull request simply removes that qualifier.

I have extended the existing enum conversion test by adding a class in an anonymous namespace. For this class a "non default constructable" from_json function is defined. The "enum" test iteself did not need to be updated. I verified that the tests no longer compiled after the addition of the new class, and did once again compile after the change in json.hpp.

@AnthonyVH
Copy link
Contributor Author

Note that (as discussed in #1647) this compile error is compiler-specific. It does not happen with e.g. Clang 10.0.0. I'm not actually sure why, I'm thinking GCC is correct here by failing to compile.

@coveralls
Copy link

coveralls commented Oct 30, 2019

Coverage Status

Coverage remained the same at 100.0% when pulling c4923e3 on AnthonyVH:develop into 3790bd9 on nlohmann:develop.

Copy link
Owner

@nlohmann nlohmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a comment.

test/src/unit-conversions.cpp Outdated Show resolved Hide resolved
@AnthonyVH
Copy link
Contributor Author

Moved the test. Not sure what's up with the failure in Travis.

Copy link
Owner

@nlohmann nlohmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@nlohmann nlohmann self-assigned this Nov 5, 2019
@nlohmann nlohmann added this to the Release 3.7.1 milestone Nov 5, 2019
@nlohmann nlohmann merged commit 7bcaba0 into nlohmann:develop Nov 5, 2019
@nlohmann
Copy link
Owner

nlohmann commented Nov 5, 2019

Thanks!

@nlohmann
Copy link
Owner

nlohmann commented Nov 5, 2019


🔖 Release item

This issue/PR will be part of the next release of the library. This template helps preparing the release notes.

Type

  • ✨ New Feature
  • 🐛 Bug Fix
  • ⚡️ Improvement
  • 🔨 Further Change
  • 🔥 Deprecated function

Description

  • Non-member operator== breaks enum (de)serialization

@AnthonyVH
Copy link
Contributor Author

Awesome!

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

Successfully merging this pull request may close these issues.

Non-member operator== breaks enum (de)serialization
3 participants