Skip to content

Fix for #1647 - #1821

Merged
nlohmann merged 5 commits into
nlohmann:developfrom
AnthonyVH:develop
Nov 5, 2019
Merged

Fix for #1647#1821
nlohmann merged 5 commits into
nlohmann:developfrom
AnthonyVH:develop

Conversation

@AnthonyVH

Copy link
Copy Markdown
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
AnthonyVH requested a review from nlohmann as a code owner October 30, 2019 14:59
@AnthonyVH

Copy link
Copy Markdown
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

coveralls commented Oct 30, 2019

Copy link
Copy Markdown

Coverage Status

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

@nlohmann nlohmann left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I added a comment.

Comment thread test/src/unit-conversions.cpp Outdated
@AnthonyVH

Copy link
Copy Markdown
Contributor Author

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

@nlohmann nlohmann left a comment

Copy link
Copy Markdown
Owner

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

nlohmann commented Nov 5, 2019

Copy link
Copy Markdown
Owner

Thanks!

@nlohmann

nlohmann commented Nov 5, 2019

Copy link
Copy Markdown
Owner

🔖 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
Copy Markdown
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