<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/64445>64445</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang will not accept certain std::bind usages when -stdlib=libc++ is specified.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          edfvogel
      </td>
    </tr>
</table>

<pre>
    The following (very contrived) program shows a program that is accepted when the g++ headers are used, but not when the libc++ headers are used.

Not sure if this is a bug in libc++, but it can pose a porting issue.   Any comments are welcome.

Thanks so much,

Ed Vogel

Here is the reproducer from a cygwin session:

$ cat b1.cpp
#include <functional>
#include <stddef.h>
using namespace std;
struct sockaddr {
  int a;
  int b;
};
extern "C" {
  int bind (int, const struct sockaddr *, size_t);
}
void f (void) {
  int sock2;
  sock2 = bind(sock2, (struct sockaddr *)&sock2, sizeof(sock2));
}

VogelEd@XLB3502Q4E ~
$ clang -c b1.cpp

VogelEd@XLB3502Q4E ~
$ clang -c -stdlib=libc++ b1.cpp
b1.cpp:13:11: error: assigning to 'int' from incompatible type '__bind<int &,
      sockaddr *, unsigned long>'
 sock2 = bind(sock2, (struct sockaddr *)&sock2, sizeof(sock2));
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.


Note that if there is no assignment of the return value, the program compiles.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0Vctu6zYTfhp6M4ggkXZkLbTwFf_iR4ECB0V3AUWOJPZQpECO7KaL8-wFJcdx0nTRAvWCJjn3mY-fZIymc4g12-zZ5riSE_U-1Kjbi-_QrhqvX-tvPULrrfVX4zpgfHvB8ArKOwrmgprxCsbguyAHiL2_RpD3M_WSwESQSuFIqOHaowPqETrG94zvoUepMUSQAWGKydsBmonAeXpXtqZRf6Ofsfz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