Open Quuxplusone opened 3 years ago
Bugzilla Link | PR51352 |
Status | NEW |
Importance | P enhancement |
Reported by | manjian (manjian2006@gmail.com) |
Reported on | 2021-08-04 23:40:37 -0700 |
Last modified on | 2021-08-04 23:52:03 -0700 |
Version | 12.0 |
Hardware | PC Linux |
CC | blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
The following patch fixes this.
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index 29038ab9fe1c..786380bed046 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -3797,9 +3797,10 @@ private:
bool Load = LoadExternal ||
!(isa<TranslationUnitDecl>(Ctx) || isa<NamespaceDecl>(Ctx));
// Enumerate all of the results in this context.
- for (DeclContextLookupResult R :
- Load ? Ctx->lookups()
- : Ctx->noload_lookups(/*PreserveInternalState=*/false)) {
+ SmallVector<DeclContextLookupResult, 8> Lookups(
+ Load ? Ctx->lookups()
+ : Ctx->noload_lookups(/*PreserveInternalState=*/false));
+ for (DeclContextLookupResult &R : Lookups) {
for (auto *D : R) {
if (auto *ND = Result.getAcceptableDecl(D)) {
Consumer.FoundDecl(ND, Visited.checkHidden(ND), Ctx, InBaseClass);