Skip to content

added explicit instantiations of 'has_from_json' and 'has_to_json' for std_fs::path#5209

Open
drcosmin wants to merge 2 commits into
nlohmann:developfrom
drcosmin:issue-4996
Open

added explicit instantiations of 'has_from_json' and 'has_to_json' for std_fs::path#5209
drcosmin wants to merge 2 commits into
nlohmann:developfrom
drcosmin:issue-4996

Conversation

@drcosmin

Copy link
Copy Markdown

Fixes #4996

TLDR:

In recent MSVC compiler versions, complex templates fail resolution. Workaround: perform explicit instantiations prior to use

Background

I had this happen in production code more on several occasions, and every time the only solution we could find was doing explicit instantiations. It started with one compiler version from VS2022, so it's not a new issue.
There are several posts on the dev community and Microsoft claims to have solved the issue, but, in my experience, this is still happening
https://developercommunity.visualstudio.com/t/failed-to-specialize-alias-template-error-after-up/1667151

Solution (implemented here)

Just instantiate the trait manually

Possible changes

  • gate the instantiation so it only runs on MSVC?

@github-actions

Copy link
Copy Markdown

🔴 Amalgamation check failed! 🔴

The source code has not been amalgamated. @drcosmin
Please read and follow the Contribution Guidelines.

@github-actions github-actions Bot added L and removed S labels Jun 15, 2026
…r std_fs::path;

Signed-off-by: drcosmin <cosmin.dr@pm.me>
@github-actions

Copy link
Copy Markdown

🔴 Amalgamation check failed! 🔴

The source code has not been amalgamated. @drcosmin
Please read and follow the Contribution Guidelines.

Comment thread single_include/nlohmann/json.hpp
Signed-off-by: drcosmin <cosmin.dr@pm.me>
@github-actions github-actions Bot added M tests and removed L labels Jun 16, 2026
Comment thread tests/src/unit-serialization.cpp
@nlohmann nlohmann mentioned this pull request Jun 16, 2026
2 tasks
@nlohmann nlohmann added the please rebase Please rebase your branch to origin/develop label Jun 16, 2026
@nlohmann

Copy link
Copy Markdown
Owner

Please update to the latest develop branch which fixes the ci_module_cpp20 job.

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

Labels

M please rebase Please rebase your branch to origin/develop tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tests don't build with VS 2026

2 participants