https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58074

--- Comment #11 from Richard Smith <richard-gccbugzilla at metafoo dot co.uk> 
---
The point of trivial (as distinguished from trivially-copyable) is that an
instance of type T can be created and "properly" initialized (albeit left with
an indeterminate value) without executing any code.

(The notion of a trivial type is not used by the core language, and is used in
the library only to constrain things like the template parameters of
basic_string and aligned_storage, where it is intentional that objects of type
T can be created by allocating suitable storage and performing no further
initialization.)

So I think the language rule after the application of the relevant DRs is
approximately right: a type with a deleted default constructor should not be
considered trivial.

(It's arguable that a type with multiple default constructors should perhaps
also not be considered trivial. Or maybe we should decide that the language
notion of "trivial" is a useless relic of "POD" and should be removed from the
core language, and that the library should be looking for types that are
trivially default-constructible and trivially-copyable in the places where it
currently looks for "trivial" types.)

Reply via email to