<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/65123>65123</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Clang cannot deduce class template arguments for a nested template
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          chromoblob
      </td>
    </tr>
</table>

<pre>
    **clang++** 16.0.0, official Windows release as well as [godbolt.org](https://godbolt.org) version

[godbolt: clang 16.0.0 against gcc 13.2](https://godbolt.org/z/W8Y8qT63b)

Compile single .cpp file with `-std=c++17`:
```c++
template <class B> struct O {
 template <class T> struct I: B {
        I(T) {}
 };
};

struct S {};

int main() {
    O<S>::I i{1};
 return 0;
}
```
see error:
```
<source>:11:13: error: no viable constructor or deduction guide for deduction of template arguments of 'I'
    O<S>::I i{1};
            ^
<source>:3:31: note: candidate template ignored: could not match 'I<T>' against 'int'
    template <class T> struct I: B {
                              ^
<source>:3:31: note: candidate function template not viable: requires 0 arguments, but 1 was provided
1 error generated.
```

If one adds the guide
```c++
template <class T> I(T) -> I<T>;
```
to `O`, it works.

[Another test program](https://godbolt.org/z/MoefnWxWr).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVcGO4ygQ_ZrKpdSWDbGdHHxI0hOpD6s-TEutPWIoO-xiyADu7O7Xr7Dd6WSmpd0ZZGFDFbxXj6IsQtC9JWqg3EP5uBJjPDnfyJN3g2uNa1etU383wHbAdtII2wPbT0-awKLK8iwHdkDXdVpqYfBVW-UuAT0ZEoFQBLyQMekN5b53qnUmZs73UD4C25xiPAfgO2BHYMdbM9viG_mgnYX8EfLd0l_3AL7DidHCAkUvtA0Reymx4Bn7T4DjP8COr5vfN99eKt4C294CHdxw1oYwaNsbwkyez9iliYuOJ4QqfwhRAX-UsyBFDVWeYOYtqnx-Fus8G2k4GxEJgR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