https://bugs.llvm.org/show_bug.cgi?id=51753

            Bug ID: 51753
           Summary: Nested std::bind with a custom placeholder fails to
                    compile
           Product: libc++
           Version: 12.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

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 );
}
```
(https://godbolt.org/z/8h1Td56c7)

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

(This bind expression is produced by Boost.Lambda2.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to