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.
Section: 16.4.6.5 [member.functions] Status: New Submitter: Jiang An Opened: 2025-07-24 Last modified: 2025-08-02
Priority: Not Prioritized
View other active issues in [member.functions].
View all other issues in [member.functions].
View all issues with New status.
Discussion:
16.4.6.5 [member.functions]/2 seems to allow that even when the constraints are not met, such a default constructor can be selected, because no restriction is imposed when no overload is originally selected. Per the discussion in LWG 2563(i) (closed as NAD), it even seems to allow the implementation to add a default constructor when there's originally none.
However, we're constraining some member functions, e.g. default constructors ofunique_ptr
,
tuple
, and variant
. Allowance of more permissive overload sets of constructors effectively
renders the Constraints meaningless, because even if the implementation doesn't constrain
the default constructors at all, it can still satisfy the restriction in
16.4.6.5 [member.functions]/2 since LWG 2259(i).
Consider the following example:
struct S { S() = delete; }; static_assert(std::is_default_constructible_v<std::tuple<S>>); std::tuple<S> t;
Even though currently the default constructor of std::tuple
is constrained (22.4.4.2 [tuple.cnstr]/6),
16.4.6.5 [member.functions]/2 seemingly allows the implementation to add another overload that's also
a default constructor, constrained by "is_default_constructible_v<Ti>
is false
for at least one i
", and then render the example well-formed or only error on actual
instantiation of the "additional" default constructor. Note that such an additional overload effectively
removes the Constraints element requirements.
Proposed resolution: