[LLVMbugs] [Bug 16337] New: Compilation fail

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jun 15 03:15:52 PDT 2013


            Bug ID: 16337
           Summary: Compilation fail
           Product: libc++
           Version: 3.2
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: hhinnant at apple.com
          Reporter: matthewtff at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

#include <functional>
#include <iostream>

template <typename Type>
class Y {
    typedef std::function<Type(Type)> Lamba;
    Lamba operator() (std::function<Type(Lamba, Type)> f) const {
        auto combined = std::bind(&Y<Type>::operator(), this, f);
        return std::bind(f, combined, std::placeholders::_1);
}; // class Y<Type>

typedef int Type;
typedef Y<Type> YCombinator;

int main(void)
    YCombinator y;
    auto result = y (
        [](YCombinator::Lamba f, Type x) {
            return x == 0 ? 1 : x * f(x - 1);
        }) (5);
    std::cout << "Result : " << result  << std::endl;
    return 0;

I've tried to compile such example code, but it fails under clang. Well it
fails whether i use libc++ or not, but errors are different. I actually don't
know if it is a libc++ bug or clang.

clang++ --version:
Apple LLVM version 4.2 (clang-425.0.27) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.4.0

As far as I know this code is quite correct, and successfully compiled and
executed using g++/Visual Studio 2010.

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/20130615/ecff669a/attachment.html>

More information about the llvm-bugs mailing list