Issue |
96469
|
Summary |
Member funciton overload resolution bug
|
Labels |
new issue
|
Assignees |
|
Reporter |
mix74rus
|
I'm not entirely sure, but to me it looks like this code shouldn't compile
```c++
#include <type_traits>
template<bool Overload>
struct Test {
int Foo(int) requires Overload;
double Foo(double) ;
};
int main() {
static_assert(
std::is_same_v<
decltype(&Test<true>::Foo),
int(Test<true>::*)(int)
>
);
return 0;
}
```
`Test<true>::Foo` looks ambiguous to me, and GCC and MSVC seem to agree, but not clang - https://godbolt.org/z/v35vez93z
While trying to understand this, I found that cppreference mentions following rule on ["Address of an overloaded function"](https://en.cppreference.com/w/cpp/language/overloaded_address) page:
> For any pair of non-template functions where one is [more constrained](https://en.cppreference.com/w/cpp/language/constraints) than another, the less constrained function is dropped from the set(since C++20)
I see how `int` overload might look "more constrained", but as I said, I'm not entirely sure
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs