]> granicus.if.org Git - clang/commitdiff
Fix PR8884 by skipping transparent contexts. The test is for LikageSpec. I
authorRafael Espindola <rafael.espindola@gmail.com>
Thu, 20 Jan 2011 02:26:24 +0000 (02:26 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Thu, 20 Jan 2011 02:26:24 +0000 (02:26 +0000)
failed to find a case where an enum context would make a difference, but
found PR9007 on the way.

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

lib/Sema/SemaDecl.cpp
test/SemaCXX/PR8884.cpp [new file with mode: 0644]

index 6bbbd541c2a48bbb261e1dd87cb27f908ca0e3ef..d28548dc2f5366c69204a4520576ef8710adf2a0 100644 (file)
@@ -5991,7 +5991,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
       // Find the context where we'll be declaring the tag.
       // FIXME: We would like to maintain the current DeclContext as the
       // lexical context,
-      while (SearchDC->isRecord())
+      while (SearchDC->isRecord() || SearchDC->isTransparentContext())
         SearchDC = SearchDC->getParent();
 
       // Find the scope where we'll be declaring the tag.
diff --git a/test/SemaCXX/PR8884.cpp b/test/SemaCXX/PR8884.cpp
new file mode 100644 (file)
index 0000000..4026465
--- /dev/null
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only  %s
+extern "C" {
+  class bar {
+    friend struct foo;
+    static struct foo& baz ();
+  };
+  struct foo {
+    void zed () {
+      bar::baz();
+    }
+  };
+}