[Bug libstdc++/105790] New: cannot constructor std::tuple of non-movable types with conversions
hui.xie1990 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue May 31 10:33:58 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105790
Bug ID: 105790
Summary: cannot constructor std::tuple of non-movable types
with conversions
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: hui.xie1990 at gmail dot com
Target Milestone: ---
```
#include <tuple>
struct Immovable{
Immovable() = default;
Immovable(Immovable&&) = delete;
};
struct ConvToImmovable{
operator Immovable() const { return Immovable{};}
};
void test(){
std::tuple<Immovable> t{ConvToImmovable{}};
}
```
The above code does not compile.
/opt/compiler-explorer/gcc-trunk-20220531/include/c++/13.0.0/tuple:91:11:
error: use of deleted function 'Immovable::Immovable(Immovable&&)'
91 | : _M_head_impl(std::forward<_UHead>(__h)) { }
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:5:5: note: declared here
5 | Immovable(Immovable&&) = delete;
According to the spec, as Immovable IS constructible from ConvToImmovable, so
the tuple's constructor that takes (UTypes&&...) should work.
More information about the Gcc-bugs
mailing list