https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94062

--- Comment #7 from m.cencora at gmail dot com ---
(In reply to Jonathan Wakely from comment #6)
> Further reduced:
> 
> struct Bar1
> {
>   Bar1(Bar1&&) = delete;
> };
> 
> struct Foo1
> {
>   operator Bar1() const;
> };
> 
> struct tuple : Bar1
> {
>   tuple() : Bar1(Foo1{}) { }
> };
> 
> tuple t;
> 
> 
> 
> elide.cc: In constructor 'tuple::tuple()':
> elide.cc:13:24: error: use of deleted function 'Bar1::Bar1(Bar1&&)'
>    13 |   tuple() : Bar1(Foo1{}) { }
>       |                        ^
> elide.cc:3:3: note: declared here
>     3 |   Bar1(Bar1&&) = delete;
>       |   ^~~~
> 
> 
> But I think this may be another instance of PR 82113 and elision shouldn't
> be done here.

Standard says that if:
std::is_constructible_v<Bar, Foo&&> 
then
std::is_constructible_v<std::tuple<Bar>, Foo&&>

So I think this is not an instance of PR 82113, but an unfortunate consequence
of how tuple is implemented in libstdc++. If tuple elements were not stored as
base classes, but as members than elision is mandatory and it would work.

But I guess to fix this you would have to break ABI (or change C++ standard).

Reply via email to