<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/126489>126489</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang] Deduction guide wrongly produces non-deducible template parameter error when it can be deduced for alias template
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ednolan
</td>
</tr>
</table>
<pre>
Given the following code:
```cpp
#include <type_traits>
template<typename T, typename V>
struct Base {
template<typename U>
Base(U);
};
template<typename T, typename V>
Base(V) -> Base<T, V*>;
template<typename V>
using Int = Base<int, V*>;
Int x(10.0f);
static_assert(std::is_same_v<decltype(x), Base<int, float*>>);
```
Clang trunk produces the following error:
```
<source>:10:1: error: deduction guide template contains a template parameter that cannot be deduced
10 | Base(V) -> Base<T, V*>;
| ^
<source>:9:19: note: non-deducible template parameter 'T'
9 | template<typename T, typename V>
| ^
```
But the same code is accepted by GCC, MSVC, and EDG.
Compiler Explorer link: https://godbolt.org/z/MaE9oh837
Before P1814, it was accurate that the deduction guide Clang is complaining about did contain a non-deducible template parameter, but this is no longer the case now that the template parameter can be deduced from the alias template.
Moreover, the Clang AST in Compiler Explorer shows that the desired deduction guide is actually being generated:
```
<deduction guide for Int> 'auto (V) -> Base<int, V *>'
```
This appears to be a rejects-valid bug from Clang that impedes usage of deduction guides for alias templates.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVUtv2zoT_TX0ZhCDIu3IWmjh-FF8iwIf0DTbgBLHMm9pUiApO7m__mIoJWnt4LZXMPSw5nnOmZGK0XQOsWbLB7bcztSQjj7UqJ23ys0ar1_rL-aMDtIR4eCt9RfjOmi9RibXjK_ZPR9_bd_To5DGtXbQCExu0muPzykokyKTO3rN1wlPvVUJp9dOnRAemdjA-9PTaBtTGNoEDyoisPKB8TUAwGfu30eHbMrE6jsTFZPkwMrtdPMf8k5Rnpio4I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