[LLVMbugs] [Bug 22109] New: Assertion failure when taking the size of template argument that is an ill-formed lambda type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jan 6 12:16:03 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22109

            Bug ID: 22109
           Summary: Assertion failure when taking the size of template
                    argument that is an ill-formed lambda type
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rtrieu at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

template <class T>
class A;

class B {
  A<int> a;
};

template <class X>
void F(X x) {
  int y = sizeof(x);
}

void Test(B b) {
  F([b]() {});
}

clang -std=c++11 foo.cc

clang-3.5: ../tools/clang/lib/AST/RecordLayoutBuilder.cpp:2807: const
clang::ASTRecordLayout &clang::ASTContext::getASTRecordLayout(const
clang::RecordDecl *) const: Assertion `!D->isInvalidDecl() && "Cannot get
layout of invalid decl!"' failed

It looks like the lambda is not marked as invalid, but should be.  Since Clang
thinks the lambda is valid, it assumes that all parts of the lambda are valid
as well, then asserting when it finds that the captured variable b has invalid
type.

-- 
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/20150106/4cef23a2/attachment.html>


More information about the llvm-bugs mailing list