[llvm-bugs] [Bug 28795] New: clang cannot compile lambda functions that are defined in template functions and have default arguments

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 1 08:01:05 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28795

            Bug ID: 28795
           Summary: clang cannot compile lambda functions that are defined
                    in template functions and have default arguments
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ahatanak at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Compiling the following code results in an assert.

$ cat t1.cpp
template<typename T>
void func() {
  enum class foo { a, b };
  auto bar = [](foo f = foo::a) { return f; };
  auto tmp = bar();
}

int main() {
  func<int>();
}

$ clang++ -std=c++14 -c t1.cpp

Assertion failed: ((isGenericMethod || ((*I)->isVariablyModifiedType() ||
(*I).getNonReferenceType()->isObjCRetainableType() || getContext()
.getCanonicalType((*I).getNonReferenceType()) .getTypePtr() == getContext()
.getCanonicalType((*Arg)->getType()) .getTypePtr())) && "type mismatch in call
argument!"), function EmitCallArgs, file
llvm/tools/clang/lib/CodeGen/CodeGenFunction.h, line 3332.

It doesn't assert if I move the definition of enum foo out of func.

-- 
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/20160801/d4b38471/attachment.html>


More information about the llvm-bugs mailing list