4 ms·
Are you sure that with https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p0593r6.html https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p05... thi
by geertj 3y ago
Are you sure that with https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p0593r6.html https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p05... this is still undefined behavior?
- martijntje 3y agoIf I read that paper correctly, that's only valid if the object can be constructed without code being run - i.e. a trivially constructible type. Since there is no limitation on the no_destroy type, you can create any type with it, including those which have a non-trivial constructor. Of course, you could use a concept to restrain it to only trivially constructible types, or you could omit the launder in an if constexpr branch and still be compliant.