public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/106608] New: [12 Regression] std::optional requires unavailable dtor
@ 2022-08-13 10:23 egor.pugin at gmail dot com
  2022-08-13 11:42 ` [Bug libstdc++/106608] " egor.pugin at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: egor.pugin at gmail dot com @ 2022-08-13 10:23 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106608
           Summary: [12 Regression] std::optional requires unavailable
                    dtor
           Product: gcc
           Version: 12.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: egor.pugin at gmail dot com
  Target Milestone: ---

by John Preston

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/dev/Telegram/SourceFiles/passport/passport_panel_edit_scans.h#L38

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/dev/Telegram/SourceFiles/passport/passport_panel_edit_scans.h#L75

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?

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-03-29  8:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-13 10:23 [Bug libstdc++/106608] New: [12 Regression] std::optional requires unavailable dtor egor.pugin at gmail dot com
2022-08-13 11:42 ` [Bug libstdc++/106608] " egor.pugin at gmail dot com
2022-08-13 12:22 ` 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

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).