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

            Bug ID: 21026
           Summary: not1 + mem_fn does not work together
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

Hi,
While nesting algorithms and functor I stumble upon a code that does not
compile:

#include <functional>
#include <algorithm>

struct Test { bool pred() const { return true; } };
int main(int argc, char *argv[])
{
  Test* t = nullptr;

  // does not work: error: no matching function for call to object of type
'const std::__1::__mem_fn<bool (Test::*)() const>
  auto f1 = std::not1(std::mem_fn(&Test::pred));
  f1(t);
  // works
  auto f2 = std::not1(std::mem_fun(&Test::pred));
  f2(t);
  // works
  auto f3 = std::not1(std::bind(&Test::pred, std::placeholders::_1));
  f3(t);
}

Compiled with: clang++ -O0 -Wall -std=c++11 test.cpp on Mac OS X:
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix


Funny thing, with GCC, it is f3 which do not compile :)
Thanks,

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to