<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1458</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="1458"></A><H4>1458.
  
Address of incomplete type vs <TT>operator&amp;()</TT>
</H4>
<B>Section: </B>7.6.2.2&#160; [<A href="https://wg21.link/expr.unary.op">expr.unary.op</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Richard Smith
 &#160;&#160;&#160;

 <B>Date: </B>2012-02-07<BR>


<P>[Moved to DR at the October, 2012 meeting.]</P>

<P>According to 7.6.2.2 [<A href="https://wg21.link/expr.unary.op#5">expr.unary.op</A>] paragraph 5,</P>

<BLOCKQUOTE>

The address of an object of incomplete type can be taken, but if the
complete type of that object is a class type that declares
<TT>operator&amp;()</TT> as a member function, then the behavior is
undefined (and no diagnostic is required).

</BLOCKQUOTE>

<P>This should actually be &#8220;ill-formed, no diagnostic
required&#8221; instead of undefined behavior, since the problem
could be detected by whole-program analysis.  Also, it's not clear
what this means for constant expressions.</P>

<P><B>Proposed resolution (February, 2012):</B></P>

<P>Change 7.6.2.2 [<A href="https://wg21.link/expr.unary.op#5">expr.unary.op</A>] paragraph 5 as follows:</P>

<BLOCKQUOTE>

<DEL>The address of an object of incomplete type can be taken, but if
the complete type of that object is a class type that declares
<TT>operator&amp;()</TT> as a member function, then the behavior is
undefined (and no diagnostic is required).</DEL> <INS>If
<TT>&amp;</TT> is applied to an lvalue of incomplete class type and
the complete type declares <TT>operator&amp;()</TT>, it is unspecified
whether the operator has the built-in meaning or the operator function
is called.</INS> The operand of <TT>&amp;</TT> shall not be a
bit-field.

</BLOCKQUOTE>

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