This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
is_assignable<Incomplete&, Incomplete&>
Section: 21.3.3 [meta.type.synop] Status: New Submitter: Casey Carter Opened: 2018-04-10 Last modified: 2023-06-12
Priority: 2
View other active issues in [meta.type.synop].
View all other issues in [meta.type.synop].
View all issues with New status.
Discussion:
LWG 2939 suggests that the the preconditions of the type traits need reevaluation.
This issue focuses specifically on is_assignable
and, by extension, its variants:
is_copy_assignable<T>
, equivalent to is_assignable<T&, const T&>
,
is_move_assignable<T>
, equivalent to is_assignable<T&, T>
,
is_trivially_assignable<T, U>
, equivalent to is_assignable<T, U> &&
/* magic */
,
is_trivially_copy_assignable<T>
, equivalent to is_assignable<T&, const T&> &&
/* magic */
,
is_trivially_move_assignable<T>
, equivalent to is_assignable<T&, T> &&
/* magic */
,
is_nothrow_assignable<T, U>
, equivalent to is_assignable<T, U> &&
noexcept(declval<T>() = declval<U>())
,
is_nothrow_copy_assignable<T>
, equivalent to is_assignable<T&, const T&> &&
noexcept(declval<T&>() = declval<const T&>())
,
is_nothrow_move_assignable<T>
, equivalent to is_assignable<T&, T> &&
noexcept(declval<T&>() = declval<T>())
, and
We note a discrepancy: is_copy_assignable<T>
requires T
to be a complete type, but the
equivalent form is_assignable<T&, const T&>
does not. The requirement for
is_copy_assignable<T>
seems sensible, since there's no way to determine whether or not the assignment
declval<T&>() = declval<const T&>()
is well-formed when T
is incomplete.
It seems that the same argument should apply to all of the above "assignable" traits, and that they must require that
the referent type is complete when given a reference type parameter to be implementable.
[2018-08 Batavia Monday issue discussion]
Issues 2797, 2939, 3022, and 3099 are all closely related. Walter to write a paper resolving them.
[2020-02-14, Prague]
LWG discussions. Set priority to 2.
[2023-06-12; Varna]
P1285R0 is related to this issue.
Proposed resolution:
This wording is relative to N4741.
- In 21.3.5.4 [meta.unary.prop] Table 42, change the Precondition text for
is_assignable
,is_trivially_assignable
, andis_nothrow_assignable
as follows:remove_cvref_t<
T
>
andremove_cvref_t<
U
>
shall be complete types,cvvoid
, or arrays of unknown bound.- In 21.3.5.4 [meta.unary.prop] Table 42, change the Precondition text for
is_copy_assignable
,is_move_assignable
,is_trivially_copy_assignable
,is_trivially_move_assignable
,is_nothrow_copy_assignable
, andis_nothrow_move_assignable
as follows:remove_cvref_t<
T
>
shall be a complete type,cvvoid
, or an array of unknown bound.