public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/85270] Trivial assignment operator not considered such
       [not found] <bug-85270-4@http.gcc.gnu.org/bugzilla/>
@ 2020-06-09 18:04 ` mpolacek at gcc dot gnu.org
  2021-12-28 10:05 ` pinskia at gcc dot gnu.org
  2023-03-14  9:50 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-06-09 18:04 UTC (permalink / raw)
  To: gcc-bugs

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 &));

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

* [Bug c++/85270] Trivial assignment operator not considered such
       [not found] <bug-85270-4@http.gcc.gnu.org/bugzilla/>
  2020-06-09 18:04 ` [Bug c++/85270] Trivial assignment operator not considered such mpolacek at gcc dot gnu.org
@ 2021-12-28 10:05 ` pinskia at gcc dot gnu.org
  2023-03-14  9:50 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-28 10:05 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-12-28
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=59426
     Ever confirmed|0                           |1

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

* [Bug c++/85270] Trivial assignment operator not considered such
       [not found] <bug-85270-4@http.gcc.gnu.org/bugzilla/>
  2020-06-09 18:04 ` [Bug c++/85270] Trivial assignment operator not considered such mpolacek at gcc dot gnu.org
  2021-12-28 10:05 ` pinskia at gcc dot gnu.org
@ 2023-03-14  9:50 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2023-03-14  9:50 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=87051
   Last reconfirmed|2021-12-28 00:00:00         |2023-3-14

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This breaks std::tuple<> due to new assignment operators in C++23:

https://godbolt.org/z/9EdPrdjhW

#include <type_traits>

template <class...> struct tuple;

template <>
struct tuple<> {
    tuple() = default;
    ~tuple() = default;

    tuple(const tuple&) = default;
    tuple(tuple&&) = default;

    tuple& operator=(const tuple&) = default;
    tuple& operator=(tuple&&) = default;

    constexpr const tuple& operator=(const tuple&) const noexcept { return
*this; }
    constexpr const tuple& operator=(tuple&&) const noexcept { return *this; }
};
static_assert(std::is_trivially_destructible_v<tuple<>>);
static_assert(std::is_trivially_default_constructible_v<tuple<>>);
static_assert(std::is_trivially_copy_constructible_v<tuple<>>);
static_assert(std::is_trivially_move_constructible_v<tuple<>>);
static_assert(std::is_trivially_copy_assignable_v<tuple<>>);
static_assert(std::is_trivially_move_assignable_v<tuple<>>);
static_assert(!std::is_trivially_copyable_v<tuple<>>);


<source>:23:20: error: static assertion failed
   23 | static_assert(std::is_trivially_copy_assignable_v<tuple<>>);
      |               ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:24:20: error: static assertion failed
   24 | static_assert(std::is_trivially_move_assignable_v<tuple<>>);
      |               ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Compiler returned: 1

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

end of thread, other threads:[~2023-03-14  9:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-85270-4@http.gcc.gnu.org/bugzilla/>
2020-06-09 18:04 ` [Bug c++/85270] Trivial assignment operator not considered such mpolacek at gcc dot gnu.org
2021-12-28 10:05 ` pinskia at gcc dot gnu.org
2023-03-14  9:50 ` redi 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).