[LLVMbugs] [Bug 10250] New: __bind in <functional> is missing copy constructor

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jul 2 10:40:59 PDT 2011


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

           Summary: __bind in <functional> is missing copy constructor
           Product: libc++
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
        AssignedTo: hhinnant at apple.com
        ReportedBy: jonathan.sauer at gmx.de
                CC: llvmbugs at cs.uiuc.edu


__bind in <functional> is missing a copy constructor, since according to
12.8p18, the implicit copy assignment operator is defined as deleted if a move
copy constructor exists (which is the case in __bind).

C.f. bug 10191.

Sample program:

#include <functional>

bool foo(int, bool, float);

template <typename F> void bar(F);

template <typename F>
void baz(F f)
{
    bar(f);
}

int main(int, char**)
{
    baz(std::bind(&foo));
}


And the error:

$ clang++ -std=c++0x -stdlib=libc++ clang.cpp 
clang.cpp:10:6: error: call to deleted constructor of 'std::__1::__bind<bool
(*)(int, bool, float),
      >'
        bar(f);
            ^
clang.cpp:15:2: note: in instantiation of function template specialization
      'baz<std::__1::__bind<bool (*)(int, bool, float), > >' requested here
        baz(std::bind(&foo));
        ^
/usr/include/c++/v1/functional:1658:7: note: function has been explicitly
marked deleted here
class __bind
      ^
clang.cpp:5:40: note: passing argument to parameter here
template <typename F> static void bar(F);
                                       ^
1 error generated.


Commenting __bind's move constructor makes the error go away, as the
requirements of 12.8p18 are no longer fulfilled.

My clang version: r134322.

My libc++ version: r134322.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list