[Bug c++/85089] New: std::minmax
kirill.okhotnikov at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Mar 27 09:49:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85089
Bug ID: 85089
Summary: std::minmax
Product: gcc
Version: 5.4.0
URL: http://cpp.sh/72nog
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: kirill.okhotnikov at gmail dot com
Target Milestone: ---
Created attachment 43765
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43765&action=edit
Source code file and detailed compiler messages.
Very simple using of minmax produces an error.
#include <iostream>
#include <string>
#include <algorithm>
int main()
{
std::pair<double, double> a = {2.0,1.0};
std::cout << a.first << " " << a.second << std::endl;
a = std::minmax(a.first, a.second);
std::cout << a.first << " " << a.second << std::endl;
}
Expected:
2 1
1 2
Got:
2 1
1 1
The same code available here http://cpp.sh/72nog. Workaround:
a = std::minmax({a.first, a.second});
More information about the Gcc-bugs
mailing list