From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 81481385828D; Wed, 28 Sep 2022 07:35:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 81481385828D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664350509; bh=Ny2+ruq82CYXCHeuSt5hlb3XuI7SIOFfnqK9ySDNgbg=; h=From:To:Subject:Date:From; b=IIa6k1JDFVm+8ipB0hWcrsrcpx3FGPBq85G3RCypSMlIhpbs4kBGepOrzVuguF8wi R3/J4xWHOCO2SnEuf1xFd/lnL7Q1ZKkhCFHsQGEbp6ECBNOMsG+m5/aHyoxqc0rfls S9OLBeO1nF39JMJgFyqrlELFr95hMHaMbm8NxkIA= From: "jlame646 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107065] New: GCC treats rvalue like lvalue Date: Wed, 28 Sep 2022 07:35:09 +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: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jlame646 at gmail dot com 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107065 Bug ID: 107065 Summary: GCC treats rvalue like lvalue Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jlame646 at gmail dot com Target Milestone: --- In the following program gcc incorrectly treats the expression `!(!b)` as lvalue. Demo: https://godbolt.org/z/zv5En5hjG ``` #include template struct value_category { // Or can be an integral or enum value static constexpr auto value =3D "prvalue"; }; template struct value_category { static constexpr auto value =3D "lvalue"; }; template struct value_category { static constexpr auto value =3D "xvalue"; }; // Double parens for ensuring we inspect an expression, // not an entity #define VALUE_CATEGORY(expr) value_category::value int main() { bool b =3D true; std::cout << VALUE_CATEGORY(!(!b)); //gcc wrongly prints lvalue } ```=