<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61273>61273</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Merged definitions of member functions distinguished by non-functionally-equivalent constraints and by deduced return type
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ecatmur
</td>
</tr>
</table>
<pre>
```c++
template<int I> concept C = true;
template<typename T> struct A {
auto f() requires C<42> { return 1; } // #1
auto f() requires true { return 2u; } // #2
};
int main() {
int (A<int>::*p)() = &A<int>::f;
unsigned (A<int>::*q)() = &A<int>::f;
return (A<int>().*p)() + (A<int>().*q)();
}
```
The above program is accepted and returns 4; the expected result would be 3. Inspection of the code (by O0 or by volatile) determines that a single `A<int>::f()` is emitted, corresponding to #.2.
Very strangely, replacing `2u` by `2l` and `unsigned` by `long` causes clang to reject: "definition with same mangled name '_ZN1AIiE1fEv' as another definition". This seems more sensible, but is apparently contra the Standard says: https://github.com/cplusplus/CWG/issues/256. I have pointed out that following the Standard would require mangling constraints, which I view as a non starter since it would break ABI now and in future.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVE2P4zYP_jXKhRjDljN2cvAhHzMvcnjbQxct0EshS7StVpa8-kjqf1_QTmZmd7stCiiJFJKPyIcPJULQvUVs2PORPZ83IsXB-QaliGPym9apuWFVvi7J-JFWfmb5IeI4GRGRlSdtI1xY-QLSWYlThBOw8gzRJ2Tlt-5xntCKEeETxYTok4xwAFbfXQEARIoOOsZ3jO_B4-ekPQY4sfK05RTF6iN4jMlbKFh5BFafARh_ZfwVGC-Lf0Oi3D6C8PQ3KHxFYfX5rQwqdRTa3vG-yJlsjO8OKyOsfGHlgRY_TIzvHxHlGRivvnbq3m6AZJeWqO9gff4vWACPAr8EW-KzrzLjx-95vd_5Bk2krJuHOtbjpwFBtO6KMHnXezGCDiAk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