[Bug c++/85270] Trivial assignment operator not considered such

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jun 9 18:04:39 GMT 2020


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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This should probably compile too:

struct S {
  S &operator=(const S &) & = default; // trivial
  S &operator=(const S &) && { return *this; } // non-trivial
};

struct R {
  S foo;
};

static_assert(__is_trivially_assignable (S &, const S &));
static_assert(__is_trivially_assignable (R &, const R &));


More information about the Gcc-bugs mailing list