<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Poor interaction between std::tuple, std::pair of types with a std::any c'tor"
href="https://bugs.llvm.org/show_bug.cgi?id=34895">34895</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Poor interaction between std::tuple, std::pair of types with a std::any c'tor
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>5.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>URL</th>
<td>https://godbolt.org/g/mBbr5U
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dlj@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>Example:
<a href="https://godbolt.org/g/mBbr5U">https://godbolt.org/g/mBbr5U</a>
struct AnyOr {
AnyOr();
explicit AnyOr(const std::any& any_value);
};
std::tuple<AnyOr> t1; // OK
std::tuple<std::any> t2{{}}; // OK
std::tuple<AnyOr> t3{{}}; // ERROR
std::tuple<AnyOr> t4{AnyOr{std::any{}}}; // ERROR
This seems to be fallout from <a href="https://reviews.llvm.org/rL276548">https://reviews.llvm.org/rL276548</a> (a.k.a.
<a href="https://reviews.llvm.org/rL276548">https://reviews.llvm.org/rL276548</a>).
I believe the poor interaction is due to:
template <class ValueType>
any::any(ValueType&& value);
participating in:
is_copy_assignable<AnyOr, const AnyOr&>
This is predicate is required by `std::tuple::tuple` (and `std::pair::pair`).
When `is_copy_assignable<AnyOr>` considers `AnyOr(const std::any&)`, the
specialization of the implicit conversion constructor `std::any::any<const
AnyOr&>` (i.e., [ValueType = const AnyOr&], [ValueType&& = const AnyOr&]) is
part of the overload set.
In turn, the `std::any::any(ValueType&&)` specialization requires
`std::is_copy_constructible<AnyOr>` (per 23.8.3.1p7:
<a href="https://timsong-cpp.github.io/cppwp/n4659/any#cons-7">https://timsong-cpp.github.io/cppwp/n4659/any#cons-7</a>).
This is a circular dependency.
This seems to me like it may be a bug in the standard, but I'm filing for extra
eyes before escalating. The CE link includes GCC/libstdc++ and MSVC (GCC fails,
MSVC passes).</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>