This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-12-20
[Voted into WP at March 2004 meeting.]
Is it legal to use an incomplete type (6.9 [basic.types] paragraph 6) as aclass 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 standardwhich explicitly disallows it.
The problem seems to be that most of the restrictions on incomplete typesare on their use in objects, but class members are not objects.
A possible resolution, if this is considered a defect, is to add to6.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>
Proposed Resolution (April 2002, revised April 2003):
Change the first bullet of the note in 6.3 [basic.def.odr] paragraph 4and add two new bullets following it, as follows:
Replace 11.4 [class.mem] paragraph 8 by:
Non-static (11.4.9 [class.static]) data members shallnot have incomplete types.In particular, a classC shall not contain a non-staticmember of classC, but it can contain a pointer or reference toan object of classC.
See also 6.9 [basic.types] paragraph 6, which is relevantbut not changed by the Proposed Resolution.