[LLVMbugs] [Bug 13849] New: Incorrect codegen for lambda in template function

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Sep 14 11:43:52 PDT 2012


             Bug #: 13849
           Summary: Incorrect codegen for lambda in template function
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: arthur.j.odwyer at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 9217
  --> http://llvm.org/bugs/attachment.cgi?id=9217
Output of "clang++ --std=c++11 test.cc --stdlib=libc++ -v"

This bug was originally reported on StackOverflow:

Apple employees take note— it's already got an Apple rdar:// number. I hope
someone will put that rdar link in a comment here.

cat >test.cc <<EOF
#include <cstdio>

template<typename T> 
void test() {
    ([](int) { puts("int"); })(0);
    ([](double) { puts("double"); })(0);
    ([](T) { puts("T"); })(0);

int main() { test<int>(); test<double>(); }
clang++ --std=c++11 test.cc --stdlib=libc++

Expected output: int double T int double T
Actual output: int double int int double double

It seems that Clang is doing some sort of lookup to find the "specializations"
of the T lambda... which is just wrong.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list