This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-11-11
(From submission #521.)
Consider:
template <class T> struct A { A() requires (false) = default; A() : t(42) {} T t; }; struct B : A<int> {};
According to the current wording, class B has a trivial default constructor, which is undesirable.
Proposed resolution (approved by CWG 2024-05-31):
Change in 11.4.5.2 [class.default.ctor] paragraph 3 as follows:
A default constructor for class X is trivial if it is not user-provided and if:Otherwise, the default constructor is non-trivial.
its classX has no virtual functions (11.7.3 [class.virtual]) and no virtual base classes (11.7.2 [class.mi]), and- no non-static data member of
its classX has a default member initializer (11.4 [class.mem]), and- all the direct base classes of its class have trivial default constructors, and
- the constructor selected to default-initialize each direct base class subobject of X is trivial,
- for all the non-static data members of its class that are of class type (or array thereof), each such class has a trivial default constructor.
- for each direct non-static data member of X that is of class type (or array thereof), the constructor selected to default-initialize that member (or an array element of that member) is trivial.