From: Evgen Bodunov <evgen@globus.software>
To: libstdc++@gcc.gnu.org
Subject: Forward declaration and std::future
Date: Sun, 12 Sep 2021 11:36:30 +0200 [thread overview]
Message-ID: <63CE1E9B-77D5-4E17-95FA-554B45C4028D@globus.software> (raw)
Hello everyone,
During development of valhalla routing project I stumbled upon compilation error on gcc + libstdc++ 11 and newer when std::future constructed from forward declared class. Live example is there: https://godbolt.org/z/rEx3Eonsz It builds on gcc prior to v11. and on any clang with libc++.
/opt/compiler-explorer/gcc-11.1.0/include/c++/11.1.0/type_traits: In instantiation of 'struct std::is_destructible<test_data>':
/opt/compiler-explorer/gcc-11.1.0/include/c++/11.1.0/future:1065:21: required from 'class std::promise<test_data>'
<source>:8:29: required from here
/opt/compiler-explorer/gcc-11.1.0/include/c++/11.1.0/type_traits:849:52: error: static assertion failed: template argument must be a complete class or an unbounded array
849 | static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/opt/compiler-explorer/gcc-11.1.0/include/c++/11.1.0/type_traits:849:52: note: 'std::__is_complete_or_unbounded<std::__type_identity<test_data> >((std::__type_identity<test_data>{}, std::__type_identity<test_data>()))' evaluates to false
In file included from <source>:1:
/opt/compiler-explorer/gcc-11.1.0/include/c++/11.1.0/future: In instantiation of 'class std::promise<test_data>':
<source>:8:29: required from here
/opt/compiler-explorer/gcc-11.1.0/include/c++/11.1.0/future:1065:21: error: static assertion failed: result type must be destructible
1065 | static_assert(is_destructible<_Res>{},
| ^~~~~~~~~~~~~~~~~~~~~~~
/opt/compiler-explorer/gcc-11.1.0/include/c++/11.1.0/future:1065:21: note: 'std::is_destructible<test_data>{}' evaluates to false
Compiler returned: 1
Is that static assert is really required? May be then it should correctly process forward declared types?
WBR,
Evgen Bodunov.
next reply other threads:[~2021-09-12 9:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-12 9:36 Evgen Bodunov [this message]
2021-09-12 18:19 ` Jonathan Wakely
[not found] ` <BFCFC341-004F-4FC9-A298-6DFAB390815D@globus.software>
2021-09-12 20:04 ` Jonathan Wakely
2021-09-13 8:32 ` Evgen Bodunov
2021-09-13 8:52 ` Jonathan Wakely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=63CE1E9B-77D5-4E17-95FA-554B45C4028D@globus.software \
--to=evgen@globus.software \
--cc=libstdc++@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).