[llvm-bugs] [Bug 52219] New: invocation of next_permutation will not compile when using libc++
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Oct 19 07:36:06 PDT 2021
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: unassignedclangbugs at nondot.org
Reporter: edward.vogel at hpe.com
CC: llvm-bugs at lists.llvm.org, mclow.lists at 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 at XLB3502Q4E ~
$ clang++ t.cpp
VogelEd at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211019/e25b11da/attachment-0001.html>
More information about the llvm-bugs
mailing list