[PATCH] D35297: [Sema] Fix operator lookup to consider local extern declarations.
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 30 16:03:05 PDT 2017
rsmith added inline comments.
================
Comment at: lib/Sema/SemaLookup.cpp:229
assert(!Redeclaration && "cannot do redeclaration operator lookup");
- IDNS = Decl::IDNS_NonMemberOperator;
+ IDNS = Decl::IDNS_NonMemberOperator | Decl::IDNS_LocalExtern;
break;
----------------
This isn't right; `IDNS_LocalExtern` finds local extern declarations in the namespace scope enclosing their declaration, so this will incorrectly allow:
```
struct A {} a;
void f() { extern bool operator==(A, A); }
bool b = a == a;
```
As far as I can see, the problem is that the constructor of `FindLocalExternScope` only enables finding local extern declarations if we're also looking for `IDNS_Ordinary`; the right fix would presumably be for it to also check for `IDNS_NonMemberOperator`.
https://reviews.llvm.org/D35297
More information about the cfe-commits
mailing list