From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0F44F3858402; Thu, 9 Dec 2021 13:36:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0F44F3858402 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/103630] New: [9/10/11/12 Regression] std::make_exception_ptr(t) is ill-formed Date: Thu, 09 Dec 2021 13:36:36 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: rejects-valid, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org 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 keywords 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: Thu, 09 Dec 2021 13:36:37 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103630 Bug ID: 103630 Summary: [9/10/11/12 Regression] std::make_exception_ptr(t) is ill-formed Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: rejects-valid, wrong-code Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- I'm not 100% this is valid, but it used to work before the changes for PR 68297: #include int i =3D 0; auto p =3D std::make_exception_ptr(i); It fails now because the new implementation uses the template argument as `_Ex*` and as `new _Ex` and those aren't valid for a reference type. And if we fix that, there's another problem which is that it uses typeid(__= ex) which means we create an exception using the static type of the argument, b= ut which matches a handler of the dynamic type: #include #include struct B { virtual ~B() =3D default; }; struct D : B { }; int main() { try { D d; auto p =3D std::make_exception_ptr(d); std::rethrow_exception(p); } catch (const D&) { abort(); } catch (const B&) { } } This throws a B but catches a D.=