From: Rafael Espindola Date: Thu, 20 Jan 2011 02:26:24 +0000 (+0000) Subject: Fix PR8884 by skipping transparent contexts. The test is for LikageSpec. I X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=706df2fb3f00450cea6809c363eee35bfb3e1025;p=clang Fix PR8884 by skipping transparent contexts. The test is for LikageSpec. I 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 --- diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 6bbbd541c2..d28548dc2f 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -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 index 0000000000..4026465a25 --- /dev/null +++ b/test/SemaCXX/PR8884.cpp @@ -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(); + } + }; +}