<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/99387>99387</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang] Low diagnostic QoI or rejection for the wrong reason on function templates with abstract parameter types
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
13steinj
</td>
</tr>
</table>
<pre>
https://github.com/llvm/llvm-project/commit/6dc1636815cb9321657f1cb7ac87a46553870dc7 aka implementation of `[dcl.fct]` changes introduced by https://wg21.link/P0929 causes the following example to trigger an ambiguous overload resolution (play around with commenting out functions at your leisure), regressing from previous behavior (the defined overload with an abstract parameter type fails SFINAE):
<details>
<summary> <a href="https://gcc.godbolt.org/z/zasedovKG">https://gcc.godbolt.org/z/zasedovKG</a> </summary>
```cpp
struct A {
virtual void a() = 0;
};
void bar(auto&&) {}
void bar(auto) {}
// void bing(A&);
// void bing(A);
// void bing(A) {}; // comment out at leisure
void baz(A& a)
{
bar(a);
// bing(a);
}
```
</details>
A change in behavior is expected, but an ambiguity error is not (personally).
>From the wording, I would at minimum _want_ a nicer error (because even without ambiguity, the relevant function template code would still error), or even expect the error to be different (non-deleted function definitions of abstract parameter types are not allowed, I would go so far as to say the overload resolution error isn't the real issue).
More specifically, I'd expect the definition-once-maybe-used of `bar` to behave at least somewhat similar to the definition of `bing` (in the case that all the `bing` lines are uncommented`. That is, provide a diagnostic _similar_ to `bing`'s `<source>:11:11: error: parameter type 'A' is an abstract class`; whereas if all one has is `bar(auto)` and a call to it, you only get `<source>:14:9: error: allocating an object of abstract class type 'A'`.
Funnily enough the implementation in gcc 14.1 of the same idea (github mirror: https://github.com/gcc-mirror/gcc/commit/55731b59e6036bd8d262feea54863399229545f4) ends up causing the same / similar low-quality diagnostic / issue.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVt2O8jgSfRpzU2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