public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114104] New: nodiscard not diagnosed on synthesized operator!=
@ 2024-02-25 19:31 redi at gcc dot gnu.org
  2024-02-25 19:35 ` [Bug c++/114104] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2024-02-25 19:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114104

            Bug ID: 114104
           Summary: nodiscard not diagnosed on synthesized operator!=
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

We fail to diagnose this C++20 code:

[[nodiscard]] bool operator==(X, int) { return true; }

int main() {
  X x, y;
  x != 0;
}

For x == 0 and 0 == x the nodiscard attribute works as expected, but not for x
!= 0

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-02-26 14:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-25 19:31 [Bug c++/114104] New: nodiscard not diagnosed on synthesized operator!= redi at gcc dot gnu.org
2024-02-25 19:35 ` [Bug c++/114104] " redi at gcc dot gnu.org
2024-02-25 20:58 ` harald at gigawatt dot nl
2024-02-25 23:34 ` redi at gcc dot gnu.org
2024-02-26 14:36 ` ppalka at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).