<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Compilation fail"
   href="http://llvm.org/bugs/show_bug.cgi?id=16337">16337</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Compilation fail
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.2
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>hhinnant@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>matthewtff@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>#include <functional>
#include <iostream>

template <typename Type>
class Y {
public:
    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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>