Issue |
99902
|
Summary |
Clang chooses the incorrect overload when explicit and implicit member functions are involved
|
Labels |
clang
|
Assignees |
|
Reporter |
ranaanoop
|
Clang incorrectly chooses the explicit object member function for the call `B{}.f()` in the below program: [Demo](https://godbolt.org/z/oY5b95944)
```
struct A {
int f() {
std::cout << "implicit\n";
return 1; }
A(const A&)
{
std::cout << "copy ctor\n";
}
A()= default;
};
struct B : A {
using A::f;
int f(this A) {
std::cout << "explicit\n";
return 2; }
};
int main() {
return B{}.f();
}
```
Clang incorrectly prints:
```
copy ctor
explicit
```
While gcc prints:
```
implicit
```
This has been discussed [here](https://stackoverflow.com/questions/78779816/overload-resolution-between-ordinary-and-explicit-object-member-functions)
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs