[Bug libstdc++/106608] [12 Regression] std::optional requires unavailable dtor

2022-08-14 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106608

--- Comment #4 from Andrew Pinski  ---
Created attachment 53453
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53453=edit
small testcase

[Bug libstdc++/106608] [12 Regression] std::optional requires unavailable dtor

2022-08-14 Thread egor.pugin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106608

--- Comment #3 from Egor Pugin  ---
Small repro https://godbolt.org/z/WKc7arxMs
Probably clang issue.

[Bug libstdc++/106608] [12 Regression] std::optional requires unavailable dtor

2022-08-13 Thread egor.pugin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106608

Egor Pugin  changed:

   What|Removed |Added

 CC||egor.pugin at gmail dot com

--- Comment #2 from Egor Pugin  ---
Created attachment 53450
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53450=edit
preprocessed repro

clang++-14 -std=gnu++20 file.cpp

[Bug libstdc++/106608] [12 Regression] std::optional requires unavailable dtor

2022-08-13 Thread egor.pugin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106608

--- Comment #1 from Egor Pugin  ---
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; }, where B is a declared, but not defined
struct:

https://github.com/telegramdesktop/tdesktop/blob/d63e50944a7949a0ecd5113d5ef82166eafc/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
with a default value nullopt:

https://github.com/telegramdesktop/tdesktop/blob/d63e50944a7949a0ecd5113d5ef82166eafc/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::_Optional_base() = default;

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

std::_Optional_payload::~_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?

===