[LLVMbugs] [Bug 13987] New: A crash on (late parsed) lambda body with local class.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Oct 1 10:11:32 PDT 2012


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

             Bug #: 13987
           Summary: A crash on (late parsed) lambda body with local class.
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: zaffanella at cs.unipr.it
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The following code shows a crash in (debug mode) clang++:

$ cat crash.cc
class Class {
  void Method(char c = []()->char {
      int d = []()->int {
        struct LateParsedClass {
          int LateParsedMethod() { return 0; }
        };
        return 0;
      }();
      return d;
    }());
};

$ clang++ -fsyntax-only -std=c++11 crash.cc
clang: SemaDecl.cpp:913: void clang::Sema::PushDeclContext(clang::Scope*,
clang::DeclContext*): Assertion `getContainingDC(DC) == CurContext && "The next
DeclContext should be lexically contained in the current one."' failed.

It seems that, when parsing (LateParsedMethod inside) LateParsedClass, the
value of Sema.CurContext is still that of the outer class Class, while the
(lexical) DC of LateParsedClass is that of the inner lambda operator() method,
hence the assertion failure.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list