[PATCH] D113709: Don't consider `LinkageSpec` when calculating DeclContext `Encloses`
Erich Keane via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 29 06:24:55 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG90010c2e1d60: Don't consider 'LinkageSpec' when calculating DeclContext 'Encloses' (authored by erichkeane).
Herald added a project: clang.
Changed prior to commit:
https://reviews.llvm.org/D113709?vs=386635&id=390337#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113709/new/
https://reviews.llvm.org/D113709
Files:
clang/lib/AST/DeclBase.cpp
clang/test/SemaCXX/lookup-through-linkage.cpp
Index: clang/test/SemaCXX/lookup-through-linkage.cpp
===================================================================
--- /dev/null
+++ clang/test/SemaCXX/lookup-through-linkage.cpp
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 %s -verify
+
+// expected-no-diagnostics
+
+extern "C++" {
+namespace A {
+namespace B {
+int bar;
+}
+} // namespace A
+namespace C {
+void foo() {
+ using namespace A;
+ (void)B::bar;
+}
+} // namespace C
+}
+
+extern "C" {
+extern "C++" {
+namespace D {
+namespace E {
+int bar;
+}
+} // namespace A
+namespace F {
+void foo() {
+ using namespace D;
+ (void)E::bar;
+}
+} // namespace C
+}
+}
Index: clang/lib/AST/DeclBase.cpp
===================================================================
--- clang/lib/AST/DeclBase.cpp
+++ clang/lib/AST/DeclBase.cpp
@@ -1212,7 +1212,7 @@
return getPrimaryContext()->Encloses(DC);
for (; DC; DC = DC->getParent())
- if (DC->getPrimaryContext() == this)
+ if (!isa<LinkageSpecDecl>(DC) && DC->getPrimaryContext() == this)
return true;
return false;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113709.390337.patch
Type: text/x-patch
Size: 1046 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211129/8d932dbb/attachment-0001.bin>
More information about the cfe-commits
mailing list