You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The wording in [class.default.ctor]p3 says a base class or a member of a class need to have a trivial default constructors for a default constructor to be trivial.
Under the current wording, class B in the following example has a trivial default constructor, which is undesirable:
template <classT>
structA {
A() requires (false) = default;
A() : t(42) {}
T t;
};
structB : A {};
Suggested resolution:
\item
-all the direct base classes of its class have trivial default constructors, and+all the direct base classes of its class have eligible trivial default constructors, and
\item
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.+type (or array thereof), each such class has an eligible trivial default constructor.
\end{itemize}
The text was updated successfully, but these errors were encountered:
I think we just want to defer to overload resolution, similar to what we do for (trivial) copy constructors.
jensmaurer
changed the title
[class.default.ctor] Trivial default constructors should also be required to be eligible
CWG2885 [class.default.ctor] Trivial default constructors should also be required to be eligible
Apr 25, 2024
Full name of submitter: Roy Jacobson
Reference (section label): [class.default.ctor]
Came up while thinking about this bug report - llvm/llvm-project#59206
Issue description:
The wording in [class.default.ctor]p3 says a base class or a member of a class need to have a trivial default constructors for a default constructor to be trivial.
Under the current wording, class B in the following example has a trivial default constructor, which is undesirable:
Suggested resolution:
The text was updated successfully, but these errors were encountered: