https://bugs.llvm.org/show_bug.cgi?id=52219
Bug ID: 52219
Summary: invocation of next_permutation will not compile when
using libc++
Product: libc++
Version: 11.0
Hardware: PC
OS: other
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: unassignedclangb...@nondot.org
Reporter: edward.vo...@hpe.com
CC: llvm-bugs@lists.llvm.org, mclow.li...@gmail.com
The following program compiles with clang and the g++ headers, but will not
compile using the libc++ headers. Visual Studio also cleanly compiles the
program.
Perhaps the program is invalid, but other headers do allow it.
Here is a cut/paste from a cygwin session:
$ cat t.cpp
#include <algorithm>
using namespace std;
struct S {
S(char ch = 0) : c(ch) {}
S(const S& x) {
}
S& operator=(const S& x) {
return (*this);
}
S& operator=(char ch) {
return (*this);
}
bool operator<(const S& x) {
return (c == x.c);
}
char c;
};
int main(int, char *[])
{
S a[10];
next_permutation(a, a + 1);
}
VogelEd@XLB3502Q4E ~
$ clang++ t.cpp
VogelEd@XLB3502Q4E ~
$ clang++ -stdlib=libc++ t.cpp
In file included from t.cpp:3:
/usr/include/c++/v1/algorithm:716:71: error: invalid operands to binary
expression ('const S' and 'const S')
bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;}
~~~ ^ ~~~
/usr/include/c++/v1/algorithm:5612:13: note: in instantiation of member
function
'std::__1::__less<S, S>::operator()' requested here
if (__comp(*--__i, *__ip1))
<remaining messages removed>
Not important, just thought I'd post it.
Thanks again for your time,
Ed Vogel
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs