Closed
Description
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.