[LLVMbugs] [Bug 16343] New: nested std::bind fails to compile

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jun 16 22:27:19 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16343

            Bug ID: 16343
           Summary: nested std::bind fails to compile
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: hhinnant at apple.com
          Reporter: j.arro.2783 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Using libc++, SVN 183522, the nested calls to std::bind in the following code
does not compile:

#include <cmath>
#include <functional>

struct power
{
  template <typename T>
  T
  operator()(T a, T b)
  {
    return std::pow(a, b);
  }
};

struct plus_one
{
  template <typename T>
  T
  operator()(T a)
  {
    return a + 1;
  }
};

int main(int argc, char** argv)
{
  using std::placeholders::_1;

  auto f = std::bind(plus_one(),
    std::bind(power(), 2, _1)
  );

  return f(5);
}

The build output is:

clang++ bind.cpp -std=c++11 -stdlib=libc++ -I
/home/jarryd/current/soft/install/clang/include/c++/v1/ -L
/home/jarryd/current/soft/install/clang/lib/

In file included from bind.cpp:2:
/home/jarryd/current/soft/install/clang/include/c++/v1/functional:1600:49:
error: 
      no type named 'type' in 'std::__1::__invoke_of<const
      std::__1::__bind<power, int, std::__1::placeholders::__ph<1> &> &, int
      &&>'
    typedef typename __invoke_of<_Ti&, _Uj...>::type type;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
/home/jarryd/current/soft/install/clang/include/c++/v1/functional:1624:14:
note: 
      in instantiation of template class 'std::__1::____mu_return<const
      std::__1::__bind<power, int, std::__1::placeholders::__ph<1> &>, false,
      true, false, std::__1::tuple<int &&> >' requested here
    : public ____mu_return<_Ti,
             ^
/home/jarryd/current/soft/install/clang/include/c++/v1/functional:1650:30:
note: 
      in instantiation of template class 'std::__1::__mu_return<const
      std::__1::__bind<power, int, std::__1::placeholders::__ph<1> &>,
      std::__1::tuple<int &&> >' requested here
                    typename __mu_return<const _BoundArgs, _TupleUj>::ty...
                             ^
/home/jarryd/current/soft/install/clang/include/c++/v1/functional:1654:18:
note: 
      in instantiation of template class 'std::__1::_is_valid_bind_return<const
      plus_one, const std::__1::tuple<std::__1::__bind<power, int,
      std::__1::placeholders::__ph<1> &> >, std::__1::tuple<int &&> >'
requested
      here
          bool = _is_valid_bind_return<_Fp, _BoundArgs, _TupleUj>::value>
                 ^
/home/jarryd/current/soft/install/clang/include/c++/v1/functional:1758:18:
note: 
      in instantiation of default argument for '__bind_return<const plus_one,
      const std::__1::tuple<std::__1::__bind<power, int,
      std::__1::placeholders::__ph<1> &> >, std::__1::tuple<int &&> >' required
      here
        typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jarryd/current/soft/install/clang/include/c++/v1/functional:1759:9: note: 
      while substituting deduced template arguments into function template
      'operator()' [with _Args = <int>]
        operator()(_Args&& ...__args) const
        ^
1 error generated.

-- 
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/20130617/efb0b517/attachment.html>


More information about the llvm-bugs mailing list