Literal types and copy constructors
6.8 [basic.types]
Jason Merrill

Created on 2010-09-16.00:00:00 last changed 102 months ago


Date: 2011-03-15.00:00:00

[Voted into the WP at the March, 2011 meeting.]

Date: 2010-11-15.00:00:00

Proposed resolution (November, 2010):

This issue is resolved by the resolution of issue 981.

Date: 2010-09-16.00:00:00

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;

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.

Date User Action Args
2014-03-03 00:00:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetmessages: + msg3302
2011-04-10 00:00:00adminsetstatus: ready -> fdis
2010-11-29 00:00:00adminsetmessages: + msg3050
2010-11-29 00:00:00adminsetstatus: open -> ready
2010-09-16 00:00:00admincreate