<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 190</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="190"></A><H4>190.
  
Layout-compatible POD-struct types
</H4>
<B>Section: </B>11.4&#160; [<A href="https://wg21.link/class.mem">class.mem</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Steve Adamczyk
 &#160;&#160;&#160;

 <B>Date: </B>20 Dec 1999<BR>





<P>The definition of layout-compatible POD-struct types in
11.4 [<A href="https://wg21.link/class.mem#14">class.mem</A>] paragraph 14
requires that
the two types</P>

<BLOCKQUOTE>
have the same number of members, and corresponding members (in order)
have layout-compatible types (3.9).
</BLOCKQUOTE>

There does not appear to be any reason for including member functions
and static data members in this requirement.  It would be more logical
to require only that the non-static data members of the two types must
match.

<P>The characteristics of layout-compatible types are not well
described in the current wording, either.  Apart from their use in
11.4 [<A href="https://wg21.link/class.mem#16">class.mem</A>] paragraph 16
to define the
term "common initial sequence," there appears to be nothing said about
which operations are possible between objects of layout-compatible types.
For example, 6.9 [<A href="https://wg21.link/basic.types">basic.types</A>]
paragraphs
2-3 give certain guarantees regarding use of <TT>memcpy</TT> on
objects of the same type; it might be reasonable to assume that the
same kinds of guarantees might apply to objects of layout-compatible
types, but that is not said.  Similarly,
7.2.1 [<A href="https://wg21.link/basic.lval#15">basic.lval</A>] paragraph 15
describes
permissible "type punning" but does not mention layout-compatible types.</P>

<P><B>Proposed resolution (10/00):</B></P>

<P>In 11.4 [<A href="https://wg21.link/class.mem">class.mem</A>] paragraphs 14 and 15, change all
occurrences of "members" to "nonstatic data members."</P>
<BR><BR>
</BODY>
</HTML>
