<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/69987>69987</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Default template arguments added in later redeclaration not considered for CTAD
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
timsong-cpp
</td>
</tr>
</table>
<pre>
```cpp
template<class> struct X {};
template<class=void> struct X;
X x;
```
Accepted by GCC and MSVC, rejected by Clang:
```
<source>:4:3: error: no viable constructor or deduction guide for deduction of template arguments of 'X'
4 | X x;
| ^
<source>:1:24: note: candidate template ignored: couldn't infer template argument ''
1 | template<class> struct X {};
| ^
<source>:1:24: note: candidate function template not viable: requires 1 argument, but 0 were provided
1 | template<class> struct X {};
| ^
1 error generated.
Compiler returned: 1
```
This affects `<memory_resource>` in GCC 13's libstdc++, which defines `polymorphic_allocator` first before adding a default template argument in a later declaration.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVE1v4zYQ_TXUZRBDImUpOuigyHFPPXVR5LagyJHMgiLVIZU0_76glLXdNlugxRKEbczne8PnkSGYySG27PjEjqdMrvHiqY1mDt5ND2pZssHr95ZV-X7VsrD8xPIu4rxYGZGJXlkZAhPPECKtKsILsPqJ1Scmnr4Xe3r1Rt-nXGP3zxf442b51vs-oFMKl4gahnf4qe9BOg0___Jrz3gPhL-h-vD1VrqJie4-9-8FRR_8SgqZeGaiK5noBBMdIJGn9MN5eDVysAjKux2wJ_AEGvWqovEOptVohPEvNj_CN-IgaVpndDEkK-P1C-P13h1KYHUP94RhO8kKwI7Pn6IsmOh4uaNLg-1ASaeNTs2uXc3kPKHevH612jFeRzBuRPontATrhgoAig3Cf3nne-Cfnv_DZlzdPs8rYufjx4OkSMLfV0MYoLhSSSIY1gg5vCEhLORfjUb9Y6hdORS7QmBChyQj6sNu7_28GIsEhHElt8-_-Bctf7mYAHIcUcUAySf6GWdP718Jb1OqcjBu03ohGK8DWDOEqBXjT9vt4e1i1AU0jsbhVmjx9n32tFyM-iqt9UpGT6nQaChEGHD0hCC1Nm4CmTLlauMn0jAOJCRT0reykmR6kUOmW6Eb0cgM26JqHou8qkSTXVp8HBDL6qirvMHH41gcVcVLrhstSt6MPDMtz7kocl7meVEXzaFA3WClsBrzUQpVsDLHWRp7sPZ1PniaMhPCim3VNI91ZuWANmxLi3OHb7A5Gedph1Gbch6GdQqszK0JMdyqRBMttqfvMQ1pGqgT4Z0u4R3hTXlpBxiNhHr7v_dfulO2km0vMS4hbRp-Zvw8mXhZh4PyM-Pn1P3j62Ehn7YT4-cNc2D8vHH6MwAA___k17FT">