From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DF8F73858D28; Sat, 4 Dec 2021 01:53:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DF8F73858D28 From: "bugmenot at mailinator dot com" To: gdb-prs@sourceware.org Subject: [Bug python/28647] New: Python pretty-printer doesn't work with std::variant containing local type Date: Sat, 04 Dec 2021 01:53:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: python X-Bugzilla-Version: 10.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: bugmenot at mailinator dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot 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://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Dec 2021 01:53:52 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28647 Bug ID: 28647 Summary: Python pretty-printer doesn't work with std::variant containing local type Product: gdb Version: 10.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: python Assignee: unassigned at sourceware dot org Reporter: bugmenot at mailinator dot com Target Milestone: --- When I compile this program: ``` #include #include struct G { int x; }; int main() { struct A { int x; }; A a; std::variant b {a}; std::vector c {a}; std::variant d {G {}}; __builtin_trap(); } ``` Then run it in gdb, note that `print b` prints ``` std::variant<> [no contained value] ``` but `print d` prints ``` std::variant [index 0] =3D {{x =3D 0}} ``` In the first case the print is wrong. It's caused by `Type.template_argument` function: If this is called in the Python shell ``` >>> gdb.lookup_symbol("b")[0].type.template_argument(0) Traceback (most recent call last): File "", line 1, in RuntimeError: syntax error ``` --=20 You are receiving this mail because: You are on the CC list for the bug.=