From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 765D7385802F; Tue, 21 Mar 2023 15:23:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 765D7385802F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679412203; bh=udyhqe7bqdh07trbVtPDRe63iXkXC5TozjrYwjXEdeY=; h=From:To:Subject:Date:From; b=ZEtMu7vAedu4R2Zq4pdOc0dTq0PcpuUocP5JesCOwlxUKpkIfgWlDc/yCYe6OzalL bRoEB7T47ReTrHk2hadLrOElLG6DfrC/pZP91doj4ctXWEMa5GWmrI9sMUFAUSOs4U AnZcAo0rzO7LNv1TiFjM4ViGSlvB8Doxpf8s9C3o= From: "tejo@bang-olufsen.dk" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109235] New: nodiscard attribute ignored with deduction guide Date: Tue, 21 Mar 2023 15:23:23 +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.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: tejo@bang-olufsen.dk 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=3D109235 Bug ID: 109235 Summary: nodiscard attribute ignored with deduction guide Product: gcc Version: 12.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: tejo@bang-olufsen.dk Target Milestone: --- I have tried implementing std::experimental::scope_exit and since this is a RAII object, I marked it with [[nodiscard]] to ensure all instances are assigned to a variable. It appears, however, that GCC ignores the nodiscard attribute when a deduct= ion guide is present. See this Godbolt link for an example: https://godbolt.org/z/v9e8dqW1o Notice how Clang correctly flags the problem.=