<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 if pack expansion of lambda contains struct with member function with dependent decl"
   href="http://llvm.org/bugs/show_bug.cgi?id=17985">17985</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>assertion if pack expansion of lambda contains struct with member function with dependent decl
          </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>C++11
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>richard-llvm@metafoo.co.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>david.majnemer@gmail.com, dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This causes IRgen to assert:

  template<typename ...T> void g(T...);
  template<typename ...T> void f() {
    g(
      []{
        struct S { T f() { static T t; return ++t; } } s;
        return s.f();
      }()...
    );
  }
  template void f<int, int, int>();

The instantiation of S::f inside each lambda looks like this:

  CXXMethodDecl 0x6a9a480 <col:22, col:54> f 'int (void)'
  `-CompoundStmt 0x6aa1628 <col:28, col:54>
    |-DeclStmt 0x6aa15a8 <col:30, col:40>
    | `-VarDecl 0x6aa1550 <col:30, col:39> t 'T' static
    `-ReturnStmt 0x6aa1608 <col:42, col:51>
      `-UnaryOperator 0x6aa15e8 <col:49, col:51> '<dependent type>' prefix '++'
        `-DeclRefExpr 0x6aa15c0 <col:51> 'T' lvalue Var 0x6aa1550 't' 'T'

That's clearly bogus: we should have substituted for T here.

Net result: IRgen asserts:

clang-3.4: lib/AST/Type.cpp:887: bool clang::Type::isConstantSizeType() const:
Assertion `!isDependent
Type() && "This doesn't make sense for dependent types"' failed.</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>