Title
Use of "structure" without definition
Status
cd1
Section
Clause [11] [class]
Submitter
James Kanze

Created on 2001-12-09.00:00:00 last changed 161 months ago

Messages

Date: 2007-04-15.00:00:00

[Voted into WP at April, 2007 meeting.]

Date: 2006-04-15.00:00:00

Proposed resolution (April, 2006):

This issue is resolved by the resolution of issue 538.

Date: 2020-12-15.00:00:00

In Clause 11 [class] paragraph 4, the first sentence says "A structure is a class definition defined with the class-key struct". As far as I know, there is no such thing as a structure in C++; it certainly isn't listed as one of the possible compound types in 6.8.3 [basic.compound]. And defining structures opens the question of whether a forward declaration is a structure or not. The parallel here with union (which follows immediately) suggests that structures and classes are really different things, since the same wording is used, and classes and unions do have some real differences, which manifest themselves outside of the definition. It also suggests that since one can't forward declare union with class and vice versa, the same should hold for struct and class -- I believe that the intent was that one could use struct and class interchangeably in forward declaration.

Suggested resolution:

I suggest something like the following:

If a class is defined with the class-key class, its members and base classes are private by default. If a class is defined with the class-key struct, its members and base classes are public by default. If a class is defined with the class-key union, its members are public by default, and it holds only one data member at a time. Such classes are called unions, and obey a number of additional restrictions, see 11.5 [class.union].
History
Date User Action Args
2008-10-05 00:00:00adminsetstatus: wp -> cd1
2007-08-05 00:00:00adminsetstatus: dr -> wp
2007-05-06 00:00:00adminsetmessages: + msg1503
2007-05-06 00:00:00adminsetstatus: ready -> dr
2006-11-05 00:00:00adminsetstatus: review -> ready
2006-04-22 00:00:00adminsetmessages: + msg1323
2006-04-22 00:00:00adminsetstatus: open -> review
2001-12-09 00:00:00admincreate