public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Evgen Bodunov <evgen@globus.software>
Cc: "libstdc++" <libstdc++@gcc.gnu.org>
Subject: Re: Forward declaration and std::future
Date: Mon, 13 Sep 2021 09:52:15 +0100	[thread overview]
Message-ID: <CAH6eHdTxP6DA=deb7+3YwDSNQoKax4Rn3-ncAx8Z+TcM1PoSxA@mail.gmail.com> (raw)
In-Reply-To: <7E360609-1A07-4A41-8775-6CD46D382067@globus.software>

On Mon, 13 Sept 2021 at 09:33, Evgen Bodunov <evgen@globus.software> wrote:
>
> > On 12.09.2021, at 22:04, Jonathan Wakely via Libstdc++ <libstdc++@gcc.gnu.org> wrote:
> >
> > On Sun, 12 Sep 2021, 19:30 Evgen Bodunov, <evgen@globus.software> wrote:
> >>
> >> Please, could you refer exact part and version of the standard?
> >>
> >
> > Please reply to the mailing list, not just to me.
> >
> > Every version of the standard has the same requirement, see
> > http://eel.is/c++draft/requirements#res.on.functions-2.5
> >
> > std::promise requires its result type to be destructible. We are allowed to
> > assert that by using is_destructible because we can assume the type is
> > complete, because [res.on.functions] says it must be.
> >
> > In a correct program, the assertion will not fail.
>
> Thank you for the detailed response. For some reason I expected that if there is not enough
> type data to compile the code correctly, there would be an error from the compiler, not from
> static_assert. As for example in case of inheritance or creating objects from a type that was
> forward declared. And in this case there is an error saying that the class doesn't have a
> destructor, although it actually exists and this is confusing.


The relevant errors are:

error: static assertion failed: template argument must be a complete
class or an unbounded array
error: static assertion failed: result type must be destructible

Neither of these says there is no destructor. It says the type is
incomplete, and not destructible. You cannot tell if a type is
destructible if it's incomplete, because you can't tell if it has a
deleted or private/protected destructor, because it's incomplete.

      reply	other threads:[~2021-09-13  8:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-12  9:36 Evgen Bodunov
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 [this message]

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='CAH6eHdTxP6DA=deb7+3YwDSNQoKax4Rn3-ncAx8Z+TcM1PoSxA@mail.gmail.com' \
    --to=jwakely.gcc@gmail.com \
    --cc=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).