Open
Description
struct E trivially_relocatable_if_eligible replaceable_if_eligible {
E (E &&);
E &operator= (E &&) = default;
};
static_assert (__builtin_is_replaceable (E), "");
E &&foo ();
void
bar (E &y)
{
E x = foo ();
y = foo ();
}
This and also
struct F trivially_relocatable_if_eligible replaceable_if_eligible {
F (F &&) = default;
F &operator= (F &&);
};
struct G replaceable_if_eligible { G (G const &) = default; };
struct I replaceable_if_eligible { I &operator= (const I &) = default; };
static_assert (__builtin_is_replaceable (F), "");
static_assert (__builtin_is_replaceable (G), "");
static_assert (__builtin_is_replaceable (I), "");
is where my current GCC implementation disagrees with clang trunk.
Sure, the E and F classes are not default-movable, but all are replaceable_if_eligible, so that is irrelevant.
I believe all of them are eligible for replacement though. None of these have any non-static data members nor bases, so the first two bullets of https://eel.is/c++draft/class.prop#6 don't apply, none of these has deleted dtor.
For the first class I've tried to show in bar function that it can be successfully direct initialized from an xvalue of type E and it can be also assigned from an xvalue of type E.