-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Assert when using std::views::filter and GCC 10 #4440
Comments
In #4498 I added the code above as test case. I get the same assertion error in the job for GCC 10.5. Furthermore, the test does not compiler with Clang 11. The test succeed with GCC 13.0 and Clang 19. Interestingly, there are no errors on Windows and macOS. To summarize (see https://github.com/nlohmann/json/actions/runs/11878152025): Does not work:
Works:
Test skipped:
|
So the feature works as expected with reasonably modern versions of GCC and Clang. The assertion in GCC 10.5.0 feels to me like a shortcoming of the implementation of For Clang, we see the features works as expected starting with Clang 16. The previous versions in the CI fail to compile the code. However, these tests rely on libstdc++ instead of libc++. Once I have some time, I will try to use libc++ with these compilers to check the behavior. If there is nothing in the library to fix this, then we can use Hedley to detect non-compliant compilers to exclude the test case and add a section to the documentation/README about ranges support. Any thoughts on this? |
Description
After upgrading from
3.9.1
to3.11.3
the code asserts when iterating over a json array that's been filtered usingstd::views::filter
due to an uninitialized iterator.In addition to my failure with 3.11.3 and GCC 10.2, I checked other combinations on Godbolt and observed the following (❌ represents the assert is seen)
Reproduction steps
https://godbolt.org/z/WbexYTqnf
Expected vs. actual results
std::views::filter
should allow you to filter a json array.Minimal code example
Error messages
Compiler and operating system
GCC 10.2
Library version
3.11.3
Validation
develop
branch is used.The text was updated successfully, but these errors were encountered: