<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 - Nested std::bind with a custom placeholder fails to compile"
   href="https://bugs.llvm.org/show_bug.cgi?id=51753">51753</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Nested std::bind with a custom placeholder fails to compile
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>12.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>pdimov@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The code
```
#include <functional>

template<int I> struct lambda2_arg
{
};

constexpr lambda2_arg<1> _1{};

namespace std
{

template<int I> struct is_placeholder< lambda2_arg<I> >: integral_constant<int,
I>
{
};

} // namespace std

struct plus_equal
{
    template<class T1, class T2> decltype(auto) operator()(T1&& t1, T2&& t2)
const
    {
        return std::forward<T1>(t1) += std::forward<T2>(t2);
    }
};

struct X
{
    int m;
};

int main()
{
    X x{ 1 };
    return std::bind( plus_equal(), std::bind( &X::m, _1 ), 1 )( x );
}
```
(<a href="https://godbolt.org/z/8h1Td56c7">https://godbolt.org/z/8h1Td56c7</a>)

fails to compile. Other standard libraries work. Using std::placeholders::_1
instead of _1 works.

(This bind expression is produced by Boost.Lambda2.)</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>