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

Reply via email to