<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/74963>74963</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Unable to compile the code since clang 16 with -std=c++2b
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
666melkor666
</td>
</tr>
</table>
<pre>
The following code does not compile since clang 16 with c++23 standard. Everything is fine if c++20 is used.
`#include <memory>
struct A
{
inline static std::unique_ptr<A> test_;
};
int main()
{
return 0;
}`
Compiler output
`In file included from <source>:1:
In file included from /opt/compiler-explorer/clang-16.0.0/bin/../include/c++/v1/memory:898:
In file included from /opt/compiler-explorer/clang-16.0.0/bin/../include/c++/v1/__memory/shared_ptr.h:31:
/opt/compiler-explorer/clang-16.0.0/bin/../include/c++/v1/__memory/unique_ptr.h:63:19: error: invalid application of 'sizeof' to an incomplete type 'A'
static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type");
^~~~~~~~~~~
/opt/compiler-explorer/clang-16.0.0/bin/../include/c++/v1/__memory/unique_ptr.h:297:7: note: in instantiation of member function 'std::default_delete<A>::operator()' requested here
__ptr_.second()(__tmp);
^
/opt/compiler-explorer/clang-16.0.0/bin/../include/c++/v1/__memory/unique_ptr.h:263:75: note: in instantiation of member function 'std::unique_ptr<A>::reset' requested here
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); }
^
<source>:5:38: note: in instantiation of member function 'std::unique_ptr<A>::~unique_ptr' requested here
inline static std::unique_ptr<A> test_;
^
<source>:3:8: note: definition of 'A' is not complete until the closing '}'
struct A
^
1 error generated.`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8Vktv4zYQ_jX0ZWBBIm09Djr4JcDAIg2atEhPAiWNLbYUqSWpbNPD_vaCkuzEu5tLi40AywQ1nMc3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