[PATCH] D44883: [Sema] Extend -Wself-assign and -Wself-assign-field to warn on overloaded self-assignment (classes)

Eric Fiselier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 2 16:42:06 PDT 2018


EricWF added a comment.

In https://reviews.llvm.org/D44883#1055018, @Quuxplusone wrote:

> @EricWF, is it important IYO that this warning not trigger in unevaluated contexts even for non-dependently-typed variables?
>  This is the case that seems to be coming up in practice in libc++ tests, but is hard to reason about because it's "only" deliberately contrived test code.
>
>   auto foo(std::exception& value)
>       noexcept(noexcept(value = value)) // ok to diagnose?
>       -> decltype(value = value)  // ok to diagnose?
>   {
>       static_assert(noexcept(value = value));  // ok to diagnose?
>   }


I don't think any of those cases should produce a warning. Self assignment doesn't actually take place, so it shouldn't produce a warning about a potential self-assignment.


Repository:
  rC Clang

https://reviews.llvm.org/D44883





More information about the cfe-commits mailing list