In C++14 void
is a literal type
A type is a literal type if it is:
— void; or
— a scalar type; or
— a reference type; or
— an array of literal type; or
— a class type (Clause 9) that has all of the following properties: — it has a trivial destructor,
— it is an aggregate type (8.5.1) or has at least one constexpr constructor or constructor template that is not a copy or move constructor, and
— all of its non-static data members and base classes are of non-volatile literal types.
In C++11 void
is not a literal type
A type is a literal type if it is:
— a scalar type; or
— a reference type referring to a literal type; or
— an array of literal type; or
— a class type (Clause 9) that has all of the following properties: — it has a trivial destructor,
— every constructor call and full-expression in the brace-or-equal-initializers for non-static data members (if any) is a constant expression (5.19),
— it is an aggregate type (8.5.1) or has at least one constexpr constructor or constructor template that is not a copy or move constructor, and
— all of its non-static data members and base classes are of literal types.
So why is void
a literal type? What benefits does it offer?