<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - invocation of next_permutation will not compile when using libc++"
   href="https://bugs.llvm.org/show_bug.cgi?id=52219">52219</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>invocation of next_permutation will not compile when using libc++
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>11.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>other
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>edward.vogel@hpe.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>