From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7FB893858D39; Tue, 7 Mar 2023 06:18:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7FB893858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678169891; bh=lxwLlWHYFjiDI1s6EtNwUSiqrMK5zbwh80zYWMJpTZ8=; h=From:To:Subject:Date:From; b=k2E/VJ7ROcRCtgquYvXOrS3cN5R3Z0RImJYB+0vHbWonR9oLMixpeOh2CVSODDUyf KJ5uIMbkCq6mwTKZU4l8QOaF8cu/vvW3OMRvOxEBy6IOH4cu+QSgAftUWXZ3OFuXDJ 9QJFIyC1uQfHwT1N3nAETS6+TExlX7WThNcZmchU= From: "fsb4000 at yandex dot ru" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/109049] New: std::declval gives wrong result for cv void Date: Tue, 07 Mar 2023 06:18:11 +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.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: fsb4000 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109049 Bug ID: 109049 Summary: std::declval gives wrong result for cv void Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: fsb4000 at yandex dot ru Target Milestone: --- A. Jiang found that: Quote: "The return type is... cursed for cv void. It seems that decltype(std::declval) should be const void() (un= til C++17) / const void() noexcept (since C++17) (same for volatile void and co= nst volatile void), but the cv-qualifiers are dropped" Code example: #include #include int main() { static_assert(std::is_same_v), const = void () noexcept>); static_assert(std::is_same_v), volatile void () noexcept>); } https://gcc.godbolt.org/z/TMe3v9sxh I've created the same issue for libc++: https://github.com/llvm/llvm-project/issues/61232=