Created on 2010-06-02.00:00:00 last changed 141 months ago
[Voted into the WP at the March, 2011 meeting.]
Proposed resolution (November, 2010):
This issue is resolved by the resolution of issue 981.
According to 6.9 [basic.types] paragraph 10, one of the requirements for a literal class type is
a trivial default constructor or at least one constexpr constructor other than the copy or move constructor
This rule has unfortunate consequences. For example, in
struct A { int x; };
struct B: A { int y; };
B is a literal type, even though it is impossible to initialize a constant of that type. Conversely, in
struct C {
int a, b;
constexpr C(int x, int y): a(x), b(y) { }
};
struct D {
int x;
C c;
};
D is not a literal type, even though it could be initialized as an aggregate.
It would be an improvement to replace the requirement for a trivial default constructor with a requirement that the class be an aggregate.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2014-03-03 00:00:00 | admin | set | status: fdis -> c++11 |
| 2011-04-10 00:00:00 | admin | set | messages: + msg3300 |
| 2011-04-10 00:00:00 | admin | set | status: ready -> fdis |
| 2010-11-29 00:00:00 | admin | set | messages: + msg3049 |
| 2010-11-29 00:00:00 | admin | set | status: drafting -> ready |
| 2010-06-02 00:00:00 | admin | create | |