Fix test suite issues discovered by Clang 15 #3135
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I validated the STL against Clang 15.0.1, which may be shipping Soon(TM) with Visual Studio.
Clang's "initialized but unused variable" warning got smarter, and noticed that
do_random_test::gen_data
intests/tr1/include/tspec_random.h
initializedint n = 0
, incrementedn
some number of times, and never used the resulting value. I've removed the offending variable.Clang diagnosed the subsumption test in
tests/std/P0898R3_concepts
as ill-formed due to ambiguity. The test does something like:c++ constexpr bool f(auto&&) { return false; } constexpr bool f(integral auto) { return true; } static_assert(f(42));
intending thatf(integral auto)
is called with the belief that its contraints subsume those off(auto&&)
. This was derived from similar subsumption tests I wrote for concepts in cmcstl2 and range-v3 which GCC's TS-era concepts implementation once accepted, but current GCC and Clang both reject it. I suspect MSVC and Clang 14 were wrong to accept the code and the call should be ambiguous, but I need to dig into the wording for partial ordering of function templates before filing a bug against MSVC. In any case, we can changef(auto&&)
tof(auto)
without impacting the test - the arguments used in the test all have scalar types - so let's do so.Clang diagnosed hundreds of unqualified calls to
move
andforward
in our tests thanks to a newunqualified-std-cast-call
warning. I don't address these in this PR, I've instead opened test: hundreds of failures with Clang 15.0.1 #3134 for us to discuss precisely how we do want to address it.