<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/57812>57812</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Nested CTAD fails with "could not match 'inner_foo<T2>' against 'int'"
</td>
</tr>
<tr>
<th>Labels</th>
<td>
c++17,
clang:frontend,
rejects-valid
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
royjacobson
</td>
</tr>
</table>
<pre>
CTAD on this example:
```C++
template <class T1>
struct outer_foo {
template <class T2>
struct inner_foo {
inner_foo(const T2& t);
};
};
void f() {
auto X = outer_foo<int>::inner_foo(1);
}
```
fails with
```
<source>:10:12: error: no viable constructor or deduction guide for deduction of template arguments of 'inner_foo'
auto X = outer_foo<int>::inner_foo(1);
^
<source>:4:10: note: candidate template ignored: could not match 'inner_foo<T2>' against 'int'
struct inner_foo {
^
<source>:4:10: note: candidate function template not viable: requires 0 arguments, but 1 was provided
1 error generated.
Compiler returned: 1
```
https://godbolt.org/z/Ea9j6GxdP
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytVEtz2yAQ_jXoshOPQLYUHXRw7KS3Tg859NZBYiWTwZACcpL--i5S4kfr6SFTD8awz2-_XdM69dZsHtdbcBbiTgfAV7l_NsiKNcu3LP_Yy3xeGybu0pqkEclURgRWbDojQ4BHzor7WRmiH7sIbozof_TOAave3QCuOIqjI8C7q7b2b1c4iZm47ZwNMTmLEiITNSuOhqzaHm8X52k_OK2gpwjkdB5ejtHBd8K1PSEnkNrGhI9IKdbn-fl5zpTlkq352kttArzouIOreoof3Og7nFPwPG3ExxrQe-fTwTo4aNkahKniRI_zQEuhorOm7g2jVgj9hcz1J6qlH8Y92hiSlInqrIzqf1QPpw9b3V-tbPlRHdUT04hBJ63SKsE74tSDdR7VpHWjUckW9jJ2u0vUxWaeGVGBHKROczDp41k9_x6kT2PtRzvzewSdMM4NSpYef47aY4D8xDoTG2jHCBxeZIBn7w7ULjWn5nOjYUDCSeHUYpZv3P5ZG_QUMI7ezqTw6zM07bsYn0Pqk3igNTjVOhMXzg90-0Xfe1k_lV9e1bfZPMOGl2WxKnKxLDLVFKouaplFHQ02XzEQEpgeh_MJFuLzbREiG71p_oBJYcd20bk9XYw5fPzcEElP2JHjgw5hRKLwYVXdcpHtmlJxlddCLsuKY4sd1lL12Iuuq3PJucqMbNGEhq3uEuD50eIJQOpDEhlpB4LQe2cjWnXSeExJw81BGj2JV9tMNyIXIq_5La-Xy7xYiF4ir6tymfdlXlUrtsxxTyQtEvBEeOabqYZ2HAIpjQ4xnJT04tGYI074KD7973bON969PcnOtcHZbCq5mer9DV_QrgU">