[PATCH] D155387: [Clang] Fix member lookup so that we don't ignore ambiguous lookups in some cases

dewen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 5 06:31:46 PDT 2023


dewen added inline comments.


================
Comment at: clang/test/CXX/class.derived/class.member.lookup/p11.cpp:15
+struct D: I1, I2, B2 {
+  using B1::f;
+  using B2::f;
----------------
```
bool correctness{true};
struct A {
    bool operator==(A const&oth) const {
	return true;
    }
};

struct B {
    bool operator==(B const&oth) const {
	return false;
    }
};

struct C {
    bool operator==(C const&oth) const {
	correctness=false;
	return false;
    }
};

typedef std::tuple<A,B,C> tuple_t ;

int test_it (void) {
    tuple_t x,y;
    return ( !(x==y) ) && correctness ;
}
```
This test case does not report an error in GCC11 and later versions. The tuple class overloads the operator==() method. Different structs also overload the operator==() method. Due to the introduction of the patch, the llvm18 reports an error when compiling the test case. Is this reasonable?




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155387/new/

https://reviews.llvm.org/D155387



More information about the cfe-commits mailing list