<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 --- - Assertion failure when taking the size of template argument that is an ill-formed lambda type"
   href="http://llvm.org/bugs/show_bug.cgi?id=22109">22109</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion failure when taking the size of template argument that is an ill-formed lambda type
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </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>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>rtrieu@google.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>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.</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>