From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 030B33858D39; Tue, 7 Mar 2023 12:32:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 030B33858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678192345; bh=NqGGAMTa3wzqDPlU4eI6yqKX9sO1OcNewxsQl4/9F3k=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PZfSkHan2T0SgXOQowIztZ8iTKS8ZQebCX0g7+vrnGQ/i3rgd5inJrCdS+XEfhFtW G5UBQo3rBT+AX4Or4rbphhvwE52lSiRxEosooY0pT9hdIulZbw79rbltvRMtynCs9R zptT1nvas9491mMhl1ff8GildKGS1P5L7QnRKnro= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/109049] std::declval gives wrong result for cv void Date: Tue, 07 Mar 2023 12:32:24 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: 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: Message-ID: In-Reply-To: References: 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 --- Comment #2 from Jonathan Wakely --- The reason it behaves this way is that we define declval as: template auto declval() noexcept -> decltype(__declval<_Tp>(0)); and decltype(__declval<_Tp>(0)) drops the cv-qualifiers. This implementatio= n is much faster to compile, and so we're not going to stop using it to "fix" the useless testcase in this bug. Nobody cares about decltype(std::declval) but they do care about compile times.=