public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "egor.pugin at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/106608] [12 Regression] std::optional requires unavailable dtor
Date: Sat, 13 Aug 2022 11:42:19 +0000	[thread overview]
Message-ID: <bug-106608-4-LDZMlmdsac@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106608-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #1 from Egor Pugin <egor.pugin at gmail dot com> ---
Update links.

===

We've tried to build Telegram Desktop with GCC 12 and got such error:

http://paste.mva.name/co36VoGr.txt

There is a struct A { vector<B> b; }, where B is a declared, but not defined
struct:

https://github.com/telegramdesktop/tdesktop/blob/d63e50944a7949ffffa0ecd5113d5ef82166eafc/Telegram/SourceFiles/passport/passport_panel_edit_scans.h#L28-L40

In the same header later in a method there is am argument of type optional<A>
with a default value nullopt:

https://github.com/telegramdesktop/tdesktop/blob/d63e50944a7949ffffa0ecd5113d5ef82166eafc/Telegram/SourceFiles/passport/passport_panel_edit_scans.h#L75-L77

When I read the error text that the compiler gave me (link above) I see, that
it wants to instantiate this constructor:

constexpr std::_Optional_base<Passport::ScanListData, false,
false>::_Optional_base() = default;

and for that it tries to instantiate (why? what for?) this destructor method:

std::_Optional_payload<Passport::ScanListData, false, false,
false>::~_Optional_payload

Which of course it can't instantiate, because the destructor of ScanListData is
not available in that place of the code, this struct is not defined yet. But
why does it need this destructor? This constructor of optional(nullopt_t) never
calls this destructor.

All major compilers (MSVC, GCC, Clang) of all (tried) modern versions (in case
of GCC — before 12) build this code without problems. Is this a GCC regression?

===

  reply	other threads:[~2022-08-13 11:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-13 10:23 [Bug libstdc++/106608] New: " egor.pugin at gmail dot com
2022-08-13 11:42 ` egor.pugin at gmail dot com [this message]
2022-08-13 12:22 ` [Bug libstdc++/106608] " egor.pugin at gmail dot com
2022-08-14  8:22 ` egor.pugin at gmail dot com
2022-08-14 16:58 ` pinskia at gcc dot gnu.org
2022-08-15  8:24 ` [Bug libstdc++/106608] [12/13 " rguenth at gcc dot gnu.org
2023-03-27 14:10 ` rguenth at gcc dot gnu.org
2023-03-29  8:33 ` redi at gcc dot gnu.org
2023-03-29  8:38 ` [Bug libstdc++/106608] std::optional requires unavailable dtor when compiled with clang redi at gcc dot gnu.org

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=bug-106608-4-LDZMlmdsac@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).