This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/85089] New: std::minmax
- From: "kirill.okhotnikov at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 27 Mar 2018 09:49:50 +0000
- Subject: [Bug c++/85089] New: std::minmax
- Auto-submitted: auto-generated
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});