<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/106642>106642</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
libc++ containers can't hold C arrays
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc++,
rejects-valid
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
cjdb
</td>
</tr>
</table>
<pre>
I don't see any wording prohibiting C arrays as a container's value type, leading me to believe that libc++ rejects `vector<int[2]>` because we don't handle it in the container's destructor.
```
In file included from <source>:1:
In file included from /opt/compiler-explorer/clang-trunk-20240829/bin/../include/c++/v1/deque:213:
In file included from /opt/compiler-explorer/clang-trunk-20240829/bin/../include/c++/v1/__split_buffer:21:
/opt/compiler-explorer/clang-trunk-20240829/bin/../include/c++/v1/__memory/allocator.h:154:84: error: object expression of non-scalar type 'char[2]' cannot be used in a pseudo-destructor expression
154 | _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI void destroy(pointer __p) { __p->~_Tp(); }
| ~~~^
/opt/compiler-explorer/clang-trunk-20240829/bin/../include/c++/v1/__memory/allocator_traits.h:334:9: note: in instantiation of member function 'std::allocator<char[2]>::destroy' requested here
334 | __a.destroy(__p);
| ^
/opt/compiler-explorer/clang-trunk-20240829/bin/../include/c++/v1/vector:984:23: note: in instantiation of function template specialization 'std::allocator_traits<std::allocator<char[2]>>::destroy<char[2], 0>' requested here
984 | __alloc_traits::destroy(__alloc(), std::__to_address(--__soon_to_be_end));
| ^
/opt/compiler-explorer/clang-trunk-20240829/bin/../include/c++/v1/vector:978:5: note: in instantiation of member function 'std::vector<char[2]>::__base_destruct_at_end' requested here
978 | __base_destruct_at_end(this->__begin_);
| ^
/opt/compiler-explorer/clang-trunk-20240829/bin/../include/c++/v1/vector:529:16: note: in instantiation of member function 'std::vector<char[2]>::__clear' requested here
529 | __vec_.__clear();
| ^
/opt/compiler-explorer/clang-trunk-20240829/bin/../include/c++/v1/vector:540:67: note: in instantiation of member function 'std::vector<char[2]>::__destroy_vector::operator()' requested here
540 | _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~vector() { __destroy_vector (*this)(); }
| ^
<source>:10:22: note: in instantiation of member function 'std::vector<char[2]>::~vector' requested here
10 | std::vector<char[2]> x;
| ^
1 error generated.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEl1GP2roSxz-NeRmBEjuQ5IGHEIgu0r3tqu1D3ywnGcC9xs6xHdo9D_vZjxxCtl2V9khHexat2JDYM-Pf_O2ZCOfkUSOuyXJDltuZ6P3J2HXzpa1ntWkf13tojSY09eAQQehH-GpsK_UROmtOspY-XJcgrBWPDoQDAY3RXkiNltDUwUWoHsE_dkhoCQrFMPuM4A3UqCReEPxJeFCybgjdELoBi1-w8Q7IKrpg440lrJTak-WGkuWWsB1ZRVBjI3qH8BWnGE9CtwpBepAa_AlfhNKi87YP9hYk2pKoGL9X0fg3_NxrOMhgRTeqb7GFgzVnIKx0prcNBu-siAkrfjmcVqbzhFaNOXdSoZ3jt04ZGyKpGiX0ce5tr_8_pxFNoozmhFa11IRWiwWh1WgsjL0iIbS6xIRWLf7RI2EFjdkbRcC565T0vO4PB7RDKFMkr-fzjGdjHwmthFKmESGFp5CGZUJYkYUvQGuDUAowdVAP4LfOonPSaDAH0EbPXSOUsIMWgdC0OQl7kxRNoRFaGw81Qu-wDQoS0DnsWzN_Fs53Vq9LBoiXCZC0BAD-3_2mfHjg293Dh11ZfNpt-f4dLz9_jtPp2X_22x2vPrz_Hy82e7gY2V5laR4JzTojtUcLnHeE5kDSTbicE7Z74p86QjNCc8I2QNLtzXv4BO9PT09kufv308C9FdK7IRuMhUTkIQfa-CDTQFFq54X2UvgxFWc812jh0OtmuBX2pm-DiFgx2SWs_D4_w6YjrJhYpWDDVnAeWzihxRsPxm7ZAOBcLJ7hXqEStnmJ7tW53c6wIh-USt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