[cfe-commits] r58916 - in /cfe/trunk: include/clang/AST/DeclBase.h include/clang/AST/DeclCXX.h include/clang/Basic/DiagnosticKinds.def lib/Sema/Sema.cpp lib/Sema/Sema.h lib/Sema/SemaCXXScopeSpec.cpp lib/Sema/SemaDecl.cpp lib/Sema/SemaDeclCXX.cpp lib/Sema/SemaExpr.cpp test/SemaCXX/nested-name-spec.cpp

Argiris Kirtzidis akyrtzi at gmail.com
Sun Nov 9 11:57:05 PST 2008


Sebastian Redl wrote:
>
> Got one.
>
> struct O {
>  struct I;
> };
>
> struct O::I {
> };
>
> Crashes with:
> clang: SemaDecl.cpp:81: void 
> clang::Sema::PushDeclContext(clang::DeclContext*): Assertion 
> `getContainingDC(DC) == CurContext && "The next DeclContext should be 
> directly contained in the current one."' failed.

Great find! Note that it also happens if you change "struct O {" to 
"namespace O {".

>
> I think the assertion is simply bogus, though.

It should say "The next DeclContext should be lexically contained in the 
current one.", which is what the assertion is about.

I think a ScopedDecl should be able to give it's lexical declaration 
context, that is:

namespace A {
   void f(); // Lexically and semantically in A
}

void A::f(){} // Semantically in A but lexically in global namespace.


Thanks a lot for your help!

-Argiris



More information about the cfe-commits mailing list