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



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to