Skip to content

Commit 1acdfce

Browse files
committed
[cling] Make cling::utils::Lookup::Named look into using directive
1 parent 37f978c commit 1acdfce

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

interpreter/cling/lib/Utils/AST.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1501,7 +1501,15 @@ namespace utils {
15011501
// No definition, no lookup result.
15021502
return;
15031503
}
1504-
S->LookupQualifiedName(R, const_cast<DeclContext*>(primaryWithin));
1504+
auto res =
1505+
S->LookupQualifiedName(R, const_cast<DeclContext*>(primaryWithin));
1506+
1507+
// If the lookup fails and the context is a namespace, try to lookup in
1508+
// the namespaces brought in by using directives.
1509+
if (!res && primaryWithin->isNamespace())
1510+
for (auto* UD : primaryWithin->using_directives())
1511+
if (NamespaceDecl* NS = UD->getNominatedNamespace())
1512+
res = S->LookupQualifiedName(R, NS);
15051513
}
15061514
}
15071515

0 commit comments

Comments
 (0)