-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
-Wmismatched-tags in 3.5.0? #1401
Comments
I'm encountering the same warning, note that some standard libraries are defining In a library of mine, I came up with the following workarround to suppress the warnings on my own namespace std {
// The GCC standard library defines tuple_size as class and struct
// which triggers a warning here.
#if defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmismatched-tags"
#endif
template <typename... Args>
struct tuple_size<cti::result<Args...>>
: std::integral_constant<size_t, sizeof...(Args)> {};
template <std::size_t I, typename... Args>
struct tuple_element<I, cti::result<Args...>>
: tuple_element<I, tuple<Args...>> {};
#if defined(__clang__)
#pragma GCC diagnostic pop
#endif
} // namespace std |
An additional reference on this issue: |
Thanks for reporting. I had a warning before I released and adjusted the code wrt. to the examples from cppreference.com. Now, I do not get any warning with GCC 9 and Clang 8. |
It looks like this might be fixed in Clang 8, but Clang 7 may also trigger it. (Was playing around with a small example linked in the isocpp group post above.) @nlohmann: Would disabling the |
@past-due Yes, of course are PRs welcome! |
Note that the C++ standard declares I'm also for explicitly disabling those warnings. |
This reverts commit b7cd350. json 3.5.0 triggers -Wmismatched-tags, and since we treat all warnings as errors, this fails the build. Upstream is aware of the problem: nlohmann/json#1401 It doesn't look like 3.5.0 contains any critical bugfixes, so I am simply rolling back to the previous version.
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. |
Please don't close, stale bot. |
While I'm aware of the workarounds, I thought you might find the following interesting.
-Wmismatched-tags
using Clang v6.0 on Ubuntu 18.04:Attempted to update Warzone 2100 from nlohmann/json 3.4.0 to 3.5.0.
(Compilation succeeds with 3.4.0. CI treats many warnings as errors.
-std=gnu++11
)Compilation succeeds without error / warnings.
[-Wmismatched-tags] is triggered
The CXX compiler identification is Clang 6.0.0
on Ubuntu 18.04
develop
branch?3.5.0 release
The text was updated successfully, but these errors were encountered: