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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to