<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/66714>66714</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`uses_allocator_construction_args` has missing forward declarations
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dieram3
</td>
</tr>
</table>
<pre>
I was trying to use `std::uninitialized_construct_using_allocator` which was recently added in libc++, but one of the uses I had failed to compile. The actual problem is with `std::uses_allocator_construction_args`, so I'll put a simplified example using that instead.
```cpp
void test()
{
using vt = std::pair<std::pmr::string, std::pair<std::pmr::string, std::pmr::string>>;
std::pmr::polymorphic_allocator<vt> alloc;
std::uses_allocator_construction_args<vt>(alloc, std::piecewise_construct,
std::forward_as_tuple("foo"),
std::forward_as_tuple("bar", "baz"));
}
```
This works with libstdc++ but fails to compile with libc++. After digging for a while, I found out the problem is that `__uses_allocator_construction_args` overloads are not forward-declared. In particular,
```cpp
template <class _Pair, class _Alloc, class _Tuple1, class _Tuple2, __enable_if_t<__is_std_pair<_Pair>, int> = 0>
_LIBCPP_HIDE_FROM_ABI constexpr auto __uses_allocator_construction_args(
const _Alloc& __alloc, piecewise_construct_t, _Tuple1&& __x, _Tuple2&& __y) noexcept;
```
is declared before
```cpp
template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_std_pair<_Pair>, int> = 0>
_LIBCPP_HIDE_FROM_ABI constexpr auto
__uses_allocator_construction_args(const _Alloc& __alloc, _Up&& __u, _Vp&& __v) noexcept
```
which is why the instantiation of the first one fails (as it can't find the second declaration).
I'd appreciate a fix. Thanks!
Note: this might be related to #64466
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VlGP6jYT_TXmZbQoOBDIAw8QFn1IX9tVtb2vlhNPEvc6dmQ7sNxfX9lkgd1erVBVVYp244lnfHzmzAzcOdloxDVZbMliN-G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