[LLVMbugs] [Bug 21026] New: not1 + mem_fn does not work together
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Sep 22 04:55:24 PDT 2014
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: unassignedclangbugs at nondot.org
Reporter: thomas.sanchz at gmail.com
CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140922/0d8475d1/attachment.html>
More information about the llvm-bugs
mailing list