- Title
- Missing requirement that class member types be complete
- Status
- cd1
- Section
- 11.4 [class.mem]
- Submitter
- Michiel Salters
Created on 2001-12-10.00:00:00 last changed 217 months ago
Messages
Date: 2004-03-15.00:00:00
[Voted into WP at March 2004 meeting.]
Date: 2002-04-15.00:00:00
Proposed Resolution (April 2002, revised April 2003): Change the first bullet of the note in 6.3 [basic.def.odr] paragraph 4
and add two new bullets following it, as follows:
Replace 11.4 [class.mem] paragraph 8 by: See also 6.9 [basic.types] paragraph 6, which is relevant
but not changed by the Proposed Resolution.
, 7.6.2.8 [expr.new]), or
Non- static (11.4.9 [class.static]) data members shall
not have incomplete types.
In particular, a class C shall not contain a non- static
member of class C , but it can contain a pointer or reference to
an object of class C .
Date: 2026-07-27.15:54:01
Is it legal to use an incomplete type (6.9 [basic.types] paragraph 6)
as a
class member, if no object of such class is ever created ? And as a class template member, even if the template is instantiated,
but no object of the instantiated class is created? The consensus seems to be NO, but no wording was found in the standard
which explicitly disallows it. The problem seems to be that most of the restrictions on incomplete types
are on their use in objects, but class members are not objects. A possible resolution, if this is considered a defect, is to add to
6.3 [basic.def.odr] paragraph 4, (situations when T must be complete),
the use of T as a member of a class or instantiated class template. The thread on comp.std.c++ which brought up the issue was
"Compiler differences: which is correct?", started 2001 11 30.
<3c07c8fb$0$8507$ed9e5944@reading.news.pipex.net>
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2008-10-05 00:00:00 | admin | set | status: wp -> cd1 |
| 2004-04-09 00:00:00 | admin | set | messages: + msg1014 |
| 2004-04-09 00:00:00 | admin | set | status: ready -> wp |
| 2003-11-15 00:00:00 | admin | set | status: review -> ready |
| 2003-04-25 00:00:00 | admin | set | status: ready -> review |
| 2002-11-08 00:00:00 | admin | set | status: review -> ready |
| 2002-05-10 00:00:00 | admin | set | messages: + msg622 |
| 2002-05-10 00:00:00 | admin | set | status: open -> review |
| 2001-12-10 00:00:00 | admin | create | |