https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86646
Arthur O'Dwyer changed:
What|Removed |Added
CC||arthur.j.odwyer at gmail dot
com
--- Comment #4 from Arthur O'Dwyer ---
I just ran into this (it's one of the examples of vendor divergence in
P2953R0).
https://isocpp.org/files/papers/P2953R0.html#corner-cases
// https://godbolt.org/z/sxv5rvn8o
template
struct C {
C& operator=(std::add_lvalue_reference_t) = default;
};
C cl;
GCC 13 says:
error: 'C< >& C<
>::operator=(std::add_lvalue_reference_t >
>)' cannot be defaulted
5 | C& operator=(std::add_lvalue_reference_t) = default;
|^~~
I confirm Andrew's observation that Clang is the odd one out in accepting this
code (GCC, MSVC, EDG all reject). But it also seems pretty obvious that it
should be accepted. Brian Bi concurs: "I couldn't figure out any reason why
this shouldn't be valid."
Or again something like this:
template
struct C {
C(std::conditional_t) = default;
C(std::conditional_t);
};
static_assert(std::is_trivially_copy_constructible_v>);
static_assert(std::is_trivially_move_constructible_v>);
GCC+EDG+MSVC reject; Clang accepts; and I think Clang is the conforming one.
A related situation is
// https://godbolt.org/z/1bhEx1Gr1
template
struct C {
template using A = const C&;
C(A...) = default;
// this is a default ctor or a copy ctor, depending on sizeof...(Ts)
};
static_assert(std::is_trivially_constructible_v>);
static_assert(std::is_trivially_copy_constructible_v>);
GCC rejects; Clang+EDG+MSVC accept; and I think Clang+EDG+MSVC are conforming.