Date
2010-09-16.00:00:00
Message id
3015

Content

According to 6.8 [basic.types] paragraph 10, a literal class type has

  • a trivial copy constructor,

  • no non-trivial move constructor,

  • ...

Is this intended to mean that

    struct A {
       A(const A&) = default;
       A(A&);
    };

is a literal class because it does have a trivial copy constructor even though it also has a non-trivial one? That seems inconsistent with the prohibition of non-trivial move constructors.

My preference would be to resolve this inconsistency by dropping the restriction on non-trivial move constructors. It seems to me that having a trivial copy or move constructor is sufficient, we don't need to prohibit additional non-trivial ones. Actually, it's not clear to me that we need the first condition either; a literal type could be used for singleton variables even if it can't be copied.