From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 483503858C2B; Tue, 23 May 2023 12:39:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 483503858C2B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684845599; bh=IhqnxG0ynqkk+XFviC2458JFTtmsoy7eDzRSTfhKz2s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=DMCHaz3nczlbGjiu2OXf8mywIAKyMsXkUXxGB3PPph5bfgFZ5JYGQgbse947CliaN UrOq76xyVOnPPmt9WCXflsdKGZId9eI69gHca34H1Sg3xNErLrk20uTjknRf0O2CEv t25SRojr4CQn19zwEJoDyKVHrOLktibVzvABEcdA= From: "roi.jacobson1 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/109941] [feat req] Add an option to mark STL types as nodiscard Date: Tue, 23 May 2023 12:39:59 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: roi.jacobson1 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: 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=3D109941 --- Comment #2 from Roy Jacobson --- Right, libc++ do that as well since 2019 - https://reviews.llvm.org/D65900?id=3D213975. Although with the RAII classes I think you need to [[nodiscard]] the constructor which I think (?) is a compiler extension. And you're also much less likely to have false positives with that so you can actually do that unconditionally :)=