http://llvm.org/bugs/show_bug.cgi?id=16633
Howard Hinnant <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |INVALID --- Comment #1 from Howard Hinnant <[email protected]> --- This is a feature, not a bug. The example violates [func.wrap.func]/p2 and p7 which require the functor to be Callable for argument types ArgTyeps and return type R. The definition of Callable requires the result of the functor to be implicitly convertible to R. But: static_assert(!std::is_convertible<bool, void>::value, ""); which is specified in [meta.rel]/p4. The violation of this requirement results in undefined behavior, meaning anything can happen. It is legal for the implementation to compile and execute the code. It is legal for the implementation to refuse to compile it. libc++ used to compile and execute this code. However that was causing problems too. For example this SO question: http://stackoverflow.com/questions/5931214/isnt-the-template-argument-the-signature-of-stdfunction-part-of-its-type complains of an ambiguity. The ambiguity can be resolved by eliminating the function(F) constructor when F is not Callable. It is possible that a future standard may require this behavior: http://cplusplus.github.io/LWG/lwg-closed.html#1024 Here is one way to work around this requirement: std::function<void ()> fns = [](){std::bind(fn, true)();}; -- 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
