From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9EE0C3890405; Sun, 28 Jun 2020 20:27:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9EE0C3890405 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1593376046; bh=+ox7p94fUVM4a7affYYQ/V9CO04iSwyBWI+XDOCsiso=; h=From:To:Subject:Date:From; b=xxQTuE5GODxjGQSZohYaT3f9ywd64QcyLD9SHyL7bFWZFmYJC6S+Y47hTvoMEDqKy N5VxsOE6CmSqadMS+YcU/Z1Zu56tpCggMw3TnFX7CwVSzDbeHWy+SV8R9cG8cWpylw 8hvZ8yFPJV7kMCHBOXNhAWWZpfUW8FIlYuLlc5KA= From: "kutdanila at yandex dot ru" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/95950] New: Call to pseudo-destructor does not end the lifetime until C++20 Date: Sun, 28 Jun 2020 20:27:26 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 9.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: kutdanila at yandex dot ru X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jun 2020 20:27:26 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95950 Bug ID: 95950 Summary: Call to pseudo-destructor does not end the lifetime until C++20 Product: gcc Version: 9.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: kutdanila at yandex dot ru Target Milestone: --- #include int main() { std::optional t =3D 2; using T =3D std::optional; t.~T(); return t.has_value(); } g++ test.cpp -O1 -o test This code should not return 0 until C++20, see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0593r4.html and http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0593r4.html#c5-c-a= nd-iso-c-2017-diffcpp17 In that case, std::optional has a trivial destructor and should have no effect The regression started somewhere in the 9th version of gcc in any optimized builds (O1-O3, with O0 still ok) Yet, static_assert works fine #include int main() { constexpr std::optional t =3D 2; using T =3D std::optional; t.~T(); static_assert(t.has_value()); }=