<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 327</TITLE>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<STYLE TYPE="text/css">
  INS { text-decoration:none; font-weight:bold; background-color:#A0FFA0 }
  .INS { text-decoration:none; background-color:#D0FFD0 }
  DEL { text-decoration:line-through; background-color:#FFA0A0 }
  .DEL { text-decoration:line-through; background-color: #FFD0D0 }
  @media (prefers-color-scheme: dark) {
    HTML { background-color:#202020; color:#f0f0f0; }
    A { color:#5bc0ff; }
    A:visited { color:#c6a8ff; }
    A:hover, a:focus { color:#afd7ff; }
    INS { background-color:#033a16; color:#aff5b4; }
    .INS { background-color: #033a16; }
    DEL { background-color:#67060c; color:#ffdcd7; }
    .DEL { background-color:#67060c; }
  }
  SPAN.cmnt { font-family:Times; font-style:italic }
</STYLE>
</HEAD>
<BODY>
<P><EM>This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21
  Core Issues List revision 118b.
  See http://www.open-std.org/jtc1/sc22/wg21/ for the official
  list.</EM></P>
<P>2025-09-28</P>
<HR>
<A NAME="327"></A><H4>327.
  
Use of "structure" without definition
</H4>
<B>Section: </B>Clause 11&#160; [<A href="https://wg21.link/class">class</A>]
 &#160;&#160;&#160;

 <B>Status: </B>CD1
 &#160;&#160;&#160;

 <B>Submitter: </B>James Kanze
 &#160;&#160;&#160;

 <B>Date: </B>9 Dec 2001<BR>


<P>[Voted into WP at April, 2007 meeting.]</P>


<P>In Clause 11 [<A href="https://wg21.link/class#4">class</A>] paragraph 4, the first sentence says
"A structure is a class
definition defined with the <I>class-key</I> <TT>struct</TT>".
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.9.4 [<A href="https://wg21.link/basic.compound">basic.compound</A>].
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.</P>

<P><B>Suggested resolution:</B></P>

<P>I suggest something like the following:</P>
<BLOCKQUOTE>
If a class is defined with the <I>class-key</I> <TT>class</TT>, its members and
base classes are private by default.  If a class is defined with
the <I>class-key</I> <TT>struct</TT>,
its members and base classes are public by
default.  If a class is defined with the <I>class-key</I> <TT>union</TT>, 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 [<A href="https://wg21.link/class.union">class.union</A>].
</BLOCKQUOTE>

<P><B>Proposed resolution (April, 2006):</B></P>

<P>This issue is resolved by the resolution of
<A HREF="538.html">issue 538</A>.</P>

<BR><BR>
</BODY>
</HTML>
