[PATCH] D45766: [Sema] Add -Wno-self-assign-overloaded

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 14 05:30:37 PDT 2018


lebedev.ri added a comment.

In https://reviews.llvm.org/D45766#1097736, @ksu.shadura wrote:

> Hi,


Hi.

> we see the false-positive behavior of -Wno-self-assign-overloaded flag in case of subtraction assignment operator. 
>  The minimal reproducer that we got: https://godbolt.org/g/8PQMpR
>  ...

Could you please clarify, what is the false-positive?
The fact that it fires on overloaded `-=` is intended behavior, and is tested in tests, see `cfe/trunk/test/SemaCXX/warn-self-assign-overloaded.cpp`:

  #ifndef DUMMY
    a *= a;
    a /= a; // expected-warning {{explicitly assigning}}
    a %= a; // expected-warning {{explicitly assigning}}
    a += a;
    a -= a; // expected-warning {{explicitly assigning}}
    a <<= a;
    a >>= a;
    a &= a; // expected-warning {{explicitly assigning}}
    a |= a; // expected-warning {{explicitly assigning}}
    a ^= a; // expected-warning {{explicitly assigning}}
  #endif



> Thanks in advance!




Repository:
  rL LLVM

https://reviews.llvm.org/D45766





More information about the cfe-commits mailing list