<algorithm>
: minmax family are returning wrong match index and may crash
#4731
Labels
wontfix
This will not be worked on
Describe the bug
Vectorized minmax family functions return wrong index / value when input contains NaNs.
Generally when input contains NaN, the behavior is undefined, because f strict weak ordering violation.
However, if the input contains only NaN value elements or NaN value elements and only one non-NaN value elements, the behavior appears to be defined: the comparisons is all false, so the strict weak ordering is met.
The below modification of test case fails though.
Command-line test case
Expected behavior
The above test pass. The algorithm returns the result as per standard.
UB cases still may fail, any expectation are only about apparently valid cases.
STL version
18c09c4
Additional context
Originally reported in #3928 (comment)
The text was updated successfully, but these errors were encountered: