[LLVMbugs] [Bug 17985] New: assertion if pack expansion of lambda contains struct with member function with dependent decl

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Nov 18 17:34:17 PST 2013


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

            Bug ID: 17985
           Summary: assertion if pack expansion of lambda contains struct
                    with member function with dependent decl
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: david.majnemer at gmail.com, dgregor at apple.com,
                    llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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.

-- 
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/20131119/7a3549d4/attachment.html>


More information about the llvm-bugs mailing list