]> granicus.if.org Git - clang/commitdiff
Fix for PR6294: we should only delay recording nested dynamic classes if they
authorEli Friedman <eli.friedman@gmail.com>
Sun, 7 Mar 2010 05:49:51 +0000 (05:49 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Sun, 7 Mar 2010 05:49:51 +0000 (05:49 +0000)
are lexically nested.  Othewise, we never end up recording semantically nested
classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97900 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
test/CodeGenCXX/default-destructor-nested.cpp [new file with mode: 0644]

index ec1939e5ece9e626a498c4de53c2161300bdeaa6..935adcf1b650fd4448bb5d15182d0686236f7a41 100644 (file)
@@ -5030,7 +5030,7 @@ void Sema::ActOnTagFinishDefinition(Scope *S, DeclPtrTy TagD,
   // Exit this scope of this tag's definition.
   PopDeclContext();
 
-  if (isa<CXXRecordDecl>(Tag) && !Tag->getDeclContext()->isRecord())
+  if (isa<CXXRecordDecl>(Tag) && !Tag->getLexicalDeclContext()->isRecord())
     RecordDynamicClassesWithNoKeyFunction(*this, cast<CXXRecordDecl>(Tag),
                                           RBraceLoc);
                                           
diff --git a/test/CodeGenCXX/default-destructor-nested.cpp b/test/CodeGenCXX/default-destructor-nested.cpp
new file mode 100644 (file)
index 0000000..8694274
--- /dev/null
@@ -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() {}