diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index ec1939e5ec..935adcf1b6 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -5030,7 +5030,7 @@ void Sema::ActOnTagFinishDefinition(Scope *S, DeclPtrTy TagD, // Exit this scope of this tag's definition. PopDeclContext(); - if (isa(Tag) && !Tag->getDeclContext()->isRecord()) + if (isa(Tag) && !Tag->getLexicalDeclContext()->isRecord()) RecordDynamicClassesWithNoKeyFunction(*this, cast(Tag), RBraceLoc); diff --git a/test/CodeGenCXX/default-destructor-nested.cpp b/test/CodeGenCXX/default-destructor-nested.cpp new file mode 100644 index 0000000000..86942743d4 --- /dev/null +++ b/test/CodeGenCXX/default-destructor-nested.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 %s -emit-llvm-only +// PR6294 + +class A { + virtual ~A(); +}; +class B { + class C; +}; +class B::C : public A { + C(); +}; +B::C::C() {}