<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/96469>96469</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Member funciton overload resolution bug
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mix74rus
</td>
</tr>
</table>
<pre>
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
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVE2TozYQ_TXi0jVTjGSDOXDwepbUHLZySCo5TgnUBmWFRPRhx_vrUw0sYyebU6ooAVJ_vH79WjIE3VvEmu0_sf1rJlMcnK9H_Ve58ylkrVO3-o3xcgTrIqCN2qO5QUgeGT9BmyJEByOCjmCc-xrA6K8IcdABOqcQwuCSUZbxMkLnxkkbZPkry4-syJenY_wTPcsuF9p2JikEJk7xNuF79FLHwMTn1WJeI46TkRGZOLXOGfj5gt44qTazEH3qIvyKIQIr1-gAANpGaJxj_KBtZLwCj38m7THcxbgzVy61BleP5YecNhtWvn58zyslGKW2jB9my_vkIcqou3cZAvpIBtvJcqqYODJx1OE9yBHfL0ycVhOFnSE65qgFlUX8-IRU8ew0Q6yoK49R16IZP_zIi_Hj7LWysbpuN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