-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed as not planned
Labels
bugSomething isn't workingSomething isn't workinginvalidThis issue is incorrect or by designThis issue is incorrect or by design
Description
Describe the bug
std::minmax_element hits an AV when nan is included in the vector. Probably not legal to include nan, but an error other than an AV would be preferred.
Command-line test case
C:\Temp>type repro.cpp
#include <algorithm>
#include <cmath>
#include <vector>
int main()
{
std::vector<double> v = {};
v.push_back(std::nan(""));
v.push_back(20.0);
v.push_back(std::nan(""));
const auto [mn, mx] = std::minmax_element(begin(v), end(v));
return 0;
}
C:\Temp>cl /EHsc /W4 /WX /std:c++latest .\repro.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.36.32522 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
/std:c++latest is provided as a preview of language features from the latest C++
working draft, and we're eager to hear about bugs and suggestions for improvements.
However, note that these features are provided as-is without support, and subject
to changes or removal as the working draft evolves. See
https://go.microsoft.com/fwlink/?linkid=2045807 for details.
repro.cpp
Microsoft (R) Incremental Linker Version 14.36.32522.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:repro.exe
repro.obj
C:\Temp>.\repro.exe
test failure
Expected behavior
Not an AV exception
STL version
Microsoft Visual Studio Community 2022
Version 17.10 Preview 7
Additional context
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinginvalidThis issue is incorrect or by designThis issue is incorrect or by design