public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/110507] New: cannot initialize immovable type in a std::tuple
@ 2023-06-30 19:55 eric.niebler at gmail dot com
2023-06-30 20:09 ` [Bug libstdc++/110507] " pinskia at gcc dot gnu.org
2023-06-30 20:12 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: eric.niebler at gmail dot com @ 2023-06-30 19:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110507
Bug ID: 110507
Summary: cannot initialize immovable type in a std::tuple
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: eric.niebler at gmail dot com
Target Milestone: ---
The following should work since C++17, when C++ got guaranteed copy elision.
#include <tuple>
struct immovable {
immovable() = default;
immovable(immovable&&) = delete;
};
struct init_immovable {
operator immovable() const { return {}; }
};
int main() {
std::tuple<immovable> m{init_immovable{}};
}
result:
In file included from <source>:1:
/opt/compiler-explorer/gcc-trunk-20230630/include/c++/14.0.0/tuple: In
instantiation of 'constexpr std::_Head_base<_Idx, _Head,
true>::_Head_base(_UHead&&) [with _UHead = init_immovable; long unsigned int
_Idx = 0; _Head = immovable]':
/opt/compiler-explorer/gcc-trunk-20230630/include/c++/14.0.0/tuple:514:38:
required from here
<source>:13:43: in 'constexpr' expansion of
'm.std::tuple<immovable>::tuple<init_immovable>(init_immovable())'
/opt/compiler-explorer/gcc-trunk-20230630/include/c++/14.0.0/tuple:891:54: in
'constexpr' expansion of '((std::_Tuple_impl<0,
immovable>*)this)->std::_Tuple_impl<0,
immovable>::_Tuple_impl<init_immovable>((* & std::forward<init_immovable>((* &
__elements#0))))'
/opt/compiler-explorer/gcc-trunk-20230630/include/c++/14.0.0/tuple:92:11:
error: use of deleted function 'immovable::immovable(immovable&&)'
92 | : _M_head_impl(std::forward<_UHead>(__h)) { }
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:5:3: note: declared here
5 | immovable(immovable&&) = delete;
| ^~~~~~~~~
https://godbolt.org/z/nfd1zdcqs
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libstdc++/110507] cannot initialize immovable type in a std::tuple
2023-06-30 19:55 [Bug libstdc++/110507] New: cannot initialize immovable type in a std::tuple eric.niebler at gmail dot com
@ 2023-06-30 20:09 ` pinskia at gcc dot gnu.org
2023-06-30 20:12 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-30 20:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110507
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>The following should work since C++17, when C++ got guaranteed copy elision.
Except for Defect report 2403 (https://wg21.link/cwg2403).
This is a dup of bug 98995.
*** This bug has been marked as a duplicate of bug 98995 ***
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libstdc++/110507] cannot initialize immovable type in a std::tuple
2023-06-30 19:55 [Bug libstdc++/110507] New: cannot initialize immovable type in a std::tuple eric.niebler at gmail dot com
2023-06-30 20:09 ` [Bug libstdc++/110507] " pinskia at gcc dot gnu.org
@ 2023-06-30 20:12 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-30 20:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110507
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note if you change immovable not to be an empty class, it works and this is why
it is a dup of bug 98995 .
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-30 20:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-30 19:55 [Bug libstdc++/110507] New: cannot initialize immovable type in a std::tuple eric.niebler at gmail dot com
2023-06-30 20:09 ` [Bug libstdc++/110507] " pinskia at gcc dot gnu.org
2023-06-30 20:12 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).