<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    Core "ready" Issues
   </TITLE>
</HEAD>
<BODY>
<TABLE ALIGN="RIGHT" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD ALIGN="RIGHT">
      Document number:
     </TD>
<TD>
       &#160;P2533R0</TD>
</TR>
<TR>
<TD ALIGN="RIGHT">
      Date:
     </TD>
<TD>
      &#160;2022-01-30</TD>
</TR>
<TR>
<TD ALIGN="RIGHT">
      Project:
     </TD>
<TD>
      &#160;Programming Language C++
     </TD>
</TR>
<TR>
<TD ALIGN="RIGHT">
      Reference:
     </TD>
<TD>
      &#160;ISO/IEC IS 14882:2020
     </TD>
</TR>
<TR>
<TD ALIGN="RIGHT">
      Reply to:
     </TD>
<TD>
      &#160;William M. Miller
     </TD>
</TR>
<TR>
<TD></TD>
<TD>
      &#160;Edison Design Group, Inc.
     </TD>
</TR>
<TR>
<TD></TD>
<TD>
      &#160;<A HREF="mailto://wmm@edg.com">wmm@edg.com</A></TD>
</TR>
</TABLE><BR CLEAR="ALL"><BR><CENTER>
<H2>
     Core Language Working Group "ready" Issues
     for the
     February, 2022 meeting
    </H2>
</CENTER><BR><P>
    References in this document reflect the section and paragraph
    numbering of document
    <A HREF="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/n4901.pdf">WG21 N4901</A>.
   </P>
<HR><A NAME="1726"></A><H4>1726.
  
Declarator operators and conversion function
</H4><B>Section: </B>11.4.8.3&#160; [class.conv.fct]
 &#160;&#160;&#160;

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

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

 <B>Date: </B>2013-08-02




<P>Presumably the following example is intended to be ill-formed:</P>

<PRE>
  struct A {
    (*operator int*());
  };
  A a;
  int *x = a; //<SPAN style="font-family:Times;font-style:italic"> Ok?</SPAN>
</PRE>

<P>It is not clear, however, which rule is supposed to reject such a
<I>member-declaration</I>.</P>

<P><B>Proposed resolution (December, 2021):</B></P>

<P>Change 11.4.8.3 [class.conv.fct] paragraph 1 as follows,
splitting the paragraph as indicated:</P>

<BLOCKQUOTE>

<P><SPAN style="text-decoration:line-through;background-color:#FFA0A0">A member function of a class <TT>X</TT> with a name of
the form</SPAN></P>

<UL><I>conversion-function-id:</I>
<UL><TT>operator</TT> <I>conversion-type-id</I>
</UL>
</UL>
<UL><I>conversion-type-id:</I>
<UL><I>type-specifier-seq conversion-declarator<SUB>opt</SUB></I>
</UL>
</UL>
<UL><I>conversion-declarator:</I>
<UL><I>ptr-operator conversion-declarator<SUB>opt</SUB>
</I>
</UL>
</UL>

<P><SPAN style="font-weight:bold;background-color:#A0FFA0">A declaration whose <I>declarator-id</I> has an
<I>unqualified-id</I> that is a <I>conversion-function-id</I>
declares a <I>conversion function</I>; its <I>declarator</I>
shall be a function declarator (9.3.4.6 [dcl.fct])
of the form</SPAN></P>

<UL><SPAN style="font-weight:bold;background-color:#A0FFA0"><I>ptr-declarator</I> <TT>(</TT> <I>parameter-declaration-clause</I> <TT>)</TT> <I>cv-qualifier-seq<SUB>opt</SUB></I></SPAN>
<UL><SPAN style="font-weight:bold;background-color:#A0FFA0"><I>ref-qualifier-seq<SUB>opt</SUB> noexcept-specifier<SUB>opt</SUB> attribute-specifier-seq<SUB>opt</SUB></I></SPAN>
</UL>
</UL>

<P><SPAN style="font-weight:bold;background-color:#A0FFA0">where the <I>ptr-declarator</I> consists solely of
an <I>id-expression</I>, an
optional <I>attribute-specifier-seq</I>, and optional surrounding
parentheses, and the <I>id-expression</I> has one of the following
forms:</SPAN></P>

<UL><LI><P><SPAN style="font-weight:bold;background-color:#A0FFA0">in a <I>member-declaration</I> that belongs
to the <I>member-specification</I> of a class or class
template but is not a friend declaration
(11.8.4 [class.friend]), the <I>id-expression</I>
is a <I>conversion-function-id</I>;</SPAN></P></LI>

<LI><P><SPAN style="font-weight:bold;background-color:#A0FFA0">otherwise, the <I>id-expression</I> is a
<I>qualified-id</I> whose <I>unqualified-id</I> is a
<I>conversion-function-id</I>.</SPAN></P></LI>

</UL>

<P><SPAN style="font-weight:bold;background-color:#A0FFA0">A conversion function</SPAN> shall have no parameters
and <SPAN style="font-weight:bold;background-color:#A0FFA0">shall be a non-static member function of a class or
class template <TT>X</TT>; it</SPAN> specifies a conversion
from <TT>X</TT> to the type specified by
the <I>conversion-type-id</I>, interpreted as
a <I>type-id</I> (9.3.2 [dcl.name]). <SPAN style="text-decoration:line-through;background-color:#FFA0A0">Such
functions are called <I>conversion functions</I>.</SPAN></P>

<P>A <I>decl-specifier</I> in the <I>decl-specifier-seq</I> of
a conversion function (if any) shall <SPAN style="font-weight:bold;background-color:#A0FFA0">not</SPAN>
be <SPAN style="text-decoration:line-through;background-color:#FFA0A0">neither</SPAN>
a <I>defining-type-specifier</I> <SPAN style="text-decoration:line-through;background-color:#FFA0A0">nor
<TT>static</TT></SPAN>. The type of the conversion function
<SPAN style="text-decoration:line-through;background-color:#FFA0A0">(9.3.4.6 [dcl.fct])</SPAN> is
&#8220;<SPAN style="font-weight:bold;background-color:#A0FFA0"><TT>noexcept</TT><SUB><I>opt</I></SUB></SPAN>
function taking no parameter <SPAN style="font-weight:bold;background-color:#A0FFA0"><I>cv-qualifier-seq<SUB>opt</SUB>
ref-qualifier<SUB>opt</SUB></I></SPAN>
returning <I>conversion-type-id</I>&#8221;.</P>

<P>A conversion function is never used to convert a
(possibly cv-qualified) object to the (possibly
cv-qualified) same object type (or a reference to it), to a
(possibly cv-qualified) base class of that type (or a
reference to it), or
to <I>cv</I> <TT>void</TT>.<SUP>102</SUP> [<I>Example
1</I>:...</P>

</BLOCKQUOTE>

<BR><BR><HR><A NAME="2494"></A><H4>2494.
  
Multiple definitions of non-odr-used entities
</H4><B>Section: </B>6.3&#160; [basic.def.odr]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Hubert Tong
 &#160;&#160;&#160;

 <B>Date: </B>2021-07-02




<P>According to 6.3 [basic.def.odr] paragraph 10,</P>

<BLOCKQUOTE>

Every program shall contain exactly one definition of every non-inline
function or variable that is odr-used in that program outside of a
discarded statement (8.5.2 [stmt.if]); no diagnostic required.

</BLOCKQUOTE>

<P>This wording could be interpreted as allowing multiple
definitions of non-inline variables and functions if they
are not odr-used. That is presumably not the intent.</P>

<P><B>Notes from the August, 2021 teleconference:</B></P>

<P>CWG observed that there is a similar problem in paragraph
13. See also issue 1849.</P>

<P><B>Proposed resolution, December, 2021:</B></P>

<OL><LI><P>Change 6.3 [basic.def.odr] paragraph 1 as follows:</P></LI>

<BLOCKQUOTE>

<P><SPAN style="font-weight:bold;background-color:#A0FFA0">Each of the following is termed a <I>definable
item:</I></SPAN></P>

<UL><LI><P><SPAN style="font-weight:bold;background-color:#A0FFA0">a class type (Clause
Clause 11 [class]),</SPAN></P></LI>

<LI><P><SPAN style="font-weight:bold;background-color:#A0FFA0">an enumeration type (9.7.1 [dcl.enum]),</SPAN></P></LI>

<LI><P><SPAN style="font-weight:bold;background-color:#A0FFA0">a function (9.3.4.6 [dcl.fct]),</SPAN></P></LI>

<LI><P><SPAN style="font-weight:bold;background-color:#A0FFA0">a variable (6.1 [basic.pre]),</SPAN></P></LI>

<LI><P><SPAN style="font-weight:bold;background-color:#A0FFA0">a templated entity (13.1 [temp.pre]),</SPAN></P></LI>

<LI><P><SPAN style="font-weight:bold;background-color:#A0FFA0">a default argument for a parameter (for a function
in a given scope) (9.3.4.7 [dcl.fct.default]), or</SPAN></P></LI>

<LI><P><SPAN style="font-weight:bold;background-color:#A0FFA0">a default template argument
(13.2 [temp.param]).</SPAN></P></LI>

</UL>

<P>No translation unit shall contain more than one definition
of any <SPAN style="text-decoration:line-through;background-color:#FFA0A0">variable, function, class type, enumeration type,
template, default argument for a parameter (for a function
in a given scope), or default template argument</SPAN>
<SPAN style="font-weight:bold;background-color:#A0FFA0">definable item</SPAN>.</P>

</BLOCKQUOTE>

<LI><P>Change 6.3 [basic.def.odr] paragraph 10 as follows:</P></LI>

<BLOCKQUOTE>

Every program shall contain <SPAN style="text-decoration:line-through;background-color:#FFA0A0">exactly</SPAN> <SPAN style="font-weight:bold;background-color:#A0FFA0">at
least</SPAN> one definition of every <SPAN style="text-decoration:line-through;background-color:#FFA0A0">non-inline</SPAN>
function or variable that is odr-used in that program
outside of a discarded statement
(8.5.2 [stmt.if]); no diagnostic required. The
definition...

</BLOCKQUOTE>

<LI><P>Change 6.3 [basic.def.odr] paragraph 13 as follows:</P></LI>

<BLOCKQUOTE>

<P><SPAN style="text-decoration:line-through;background-color:#FFA0A0">There can be more than one definition of a</SPAN></P>

<UL><LI><P><SPAN style="text-decoration:line-through;background-color:#FFA0A0">class type (Clause Clause 11 [class]),</SPAN>
</P></LI>

<LI><P><SPAN style="text-decoration:line-through;background-color:#FFA0A0">enumeration type (9.7.1 [dcl.enum]),</SPAN>
</P></LI>

<LI><P><SPAN style="text-decoration:line-through;background-color:#FFA0A0">inline function or variable (9.2.8 [dcl.inline]),</SPAN>
</P></LI>

<LI><P><SPAN style="text-decoration:line-through;background-color:#FFA0A0">templated entity (13.1 [temp.pre]),</SPAN>
</P></LI>

<LI><P><SPAN style="text-decoration:line-through;background-color:#FFA0A0">default argument for a parameter (for a function in a given
scope) (9.3.4.7 [dcl.fct.default]), or</SPAN>
</P></LI>

<LI><P><SPAN style="text-decoration:line-through;background-color:#FFA0A0">default template argument (13.2 [temp.param])</SPAN>
</P></LI>

</UL>

<P><SPAN style="text-decoration:line-through;background-color:#FFA0A0">in a program provided that each definition appears in a
different translation unit and the definitions satisfy the
following requirements.</SPAN> <SPAN style="font-weight:bold;background-color:#A0FFA0">For any definable item
<TT>D</TT> with definitions in multiple translation units,</SPAN></P>

<UL><LI><P><SPAN style="font-weight:bold;background-color:#A0FFA0">if <TT>D</TT> is a non-inline non-templated
function or variable, or</SPAN></P></LI>

<LI><P><SPAN style="font-weight:bold;background-color:#A0FFA0">if the definitions in different translation
units do not satisfy the following requirements,</SPAN></P></LI>

</UL>

<P><SPAN style="font-weight:bold;background-color:#A0FFA0">the program is ill-formed; a diagnostic is required only if the
definable item is attached to a named module and a prior definition is
reachable at the point where a later definition occurs.</SPAN> Given such
an <SPAN style="text-decoration:line-through;background-color:#FFA0A0">entity <TT>D</TT> defined in more than one translation
unit</SPAN> <SPAN style="font-weight:bold;background-color:#A0FFA0">item</SPAN>, for all definitions of <TT>D</TT>, or,
if <TT>D</TT> is an unnamed enumeration, for all definitions of <TT>D</TT>
that are reachable at any given program point, the following requirements
shall be satisfied...</P>

</BLOCKQUOTE>

<LI><P>Delete 6.3 [basic.def.odr] paragraph 15:</P></LI>

<BLOCKQUOTE>

<SPAN style="text-decoration:line-through;background-color:#FFA0A0">If these definitions do not satisfy these requirements, then
the program is ill-formed; a diagnostic is required only if
the entity is attached to a named module and a prior
definition is reachable at the point where a later
definition occurs.</SPAN>

</BLOCKQUOTE>

</OL>

<BR><BR><HR><A NAME="2499"></A><H4>2499.
  
Inconsistency in definition of pointer-interconvertibility
</H4><B>Section: </B>6.8.3&#160; [basic.compound]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Jason Merrill
 &#160;&#160;&#160;

 <B>Date: </B>2021-07-29




<P>The changes for issue 2254
included the following:</P>

<P>Change 6.8.3 [basic.compound] bullet 4.3 as follows:</P>

<BLOCKQUOTE>

<P>Two objects <I>a</I> and <I>b</I>
are <I>pointer-interconvertible</I> if:</P>

<UL><LI><P>...</P></LI>

<LI><P>one is a standard-layout class object and the other
is the first non-static data member of that object, or, if
the object has no non-static data members, <SPAN style="text-decoration:line-through;background-color:#FFA0A0">the
first</SPAN> <SPAN style="font-weight:bold;background-color:#A0FFA0">any</SPAN> base class subobject of that
object (11.4 [class.mem]), or</P></LI></UL>

</BLOCKQUOTE>

<P>This should also have removed the phrase,</P>

<BLOCKQUOTE>

or, if the object has no non-static data members,

</BLOCKQUOTE>

<P>since the change to 11.4 [class.mem]
paragraph 25 specifies that all bases of a standard-layout
class have the same address, regardless of whether the
derived class has non-static data members.</P>

<P><B>Proposed resolution (November, 2021):</B></P>

<P>Change 6.8.3 [basic.compound] bullet 4.3 as follows:</P>

<BLOCKQUOTE>

<P>Two objects <I>a</I> and <I>b</I>
are <I>pointer-interconvertible</I> if:</P>

<UL><LI><P>...</P></LI>

<LI><P>one is a standard-layout class object and the other
is the first non-static data member of that
object<SPAN style="text-decoration:line-through;background-color:#FFA0A0">,</SPAN> or<SPAN style="text-decoration:line-through;background-color:#FFA0A0">, if the object has no non-static
data members,</SPAN> any base class subobject of that object
(11.4 [class.mem]), or</P></LI>

<LI><P>...</P></LI>

</UL>

</BLOCKQUOTE>

<BR><BR><HR><A NAME="2502"></A><H4>2502.
  
Unintended declaration conflicts in nested statement scopes
</H4><B>Section: </B>6.4.3&#160; [basic.scope.block]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Jens Maurer
 &#160;&#160;&#160;

 <B>Date: </B>2021-08-26




<P>The changes of P1787R6 inadvertently made constructs like</P>

<PRE>
  if (int a = 1)
    if (int a = 1)
      ...
</PRE>

<P>ill-formed.</P>

<P><B>Proposed resolution (September, 2021):</B></P>

<P>Change 6.4.3 [basic.scope.block] bullet 2.2 as follows:</P>

<BLOCKQUOTE>

<P> If a declaration whose target scope is the block
scope <I>S</I> of a</P>

<UL><LI><P><I>compound-statement</I> of
a <I>lambda-expression</I>, <I>function-body</I>,
or <I>function-try-block</I>,</P></LI>

<LI><P>substatement of a selection or iteration statement
<SPAN style="font-weight:bold;background-color:#A0FFA0">that is not itself a selection or iteration
statement</SPAN>, or</P></LI>

<LI>

<P><I>handler</I> of a <I>function-try-block</I></P></LI>

</UL>

<P>potentially conflicts with a declaration whose target scope
is the parent scope of <I>S</I>, the program is ill-formed.</P>

</BLOCKQUOTE>

<P>(See
<A HREF="https://github.com/cplusplus/draft/pull/4843">editorial
issue 4843</A>.)
</P>

<BR><BR><HR><A NAME="2506"></A><H4>2506.
  
Structured bindings and array cv-qualifiers
</H4><B>Section: </B>9.6&#160; [dcl.struct.bind]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Barry Revzin
 &#160;&#160;&#160;

 <B>Date: </B>2018-12-11




<P>According to 9.6 [dcl.struct.bind] paragraph 1,</P>

<BLOCKQUOTE>

<P>A structured binding declaration introduces the
identifiers <TT>v<SUB>0</SUB></TT>, <TT>v<SUB>1</SUB></TT>,
<TT>v<SUB>2</SUB></TT>, ... of the <I>identifier-list</I> as
names of <I>structured bindings</I>. Let <I>cv</I> denote
the <I>cv-qualifier</I>s in the <I>decl-specifier-seq</I>
and <I>S</I> consist of the <I>storage-class-specifier</I>s
of the <I>decl-specifier-seq</I> (if any). A <I>cv</I> that
includes volatile is deprecated; see
D.5 [depr.volatile.type]. First, a variable with a unique
name <I>e</I> is introduced. If
the <I>assignment-expression</I> in the initializer has
array type <TT>A</TT> and no <I>ref-qualifier</I> is
present, <I>e</I> is defined by</P>

<UL><I>attribute-specifier-seq<SUB>opt</SUB> S cv</I> <TT>A</TT> <I>e</I> <TT>;</TT></UL>

<P>and each element is copy-initialized or direct-initialized
from the corresponding element of
the <I>assignment-expression</I> as specified by the form of
the initializer.</P>

</BLOCKQUOTE>

<P>This means that in an example like</P>

<PRE>
  const int arr[1]{};
  auto [i] = arr;
</PRE>

<P><TT>i</TT> is a reference to <TT>const int</TT>. Presumably
the fact that the array is copied should drop the array's
cv-qualification.</P>

<P><B>Proposed resolution (December, 2021):</B></P>

<P>Change 9.6 [dcl.struct.bind] paragraph 1 as follows:</P>

<BLOCKQUOTE>

<P>If the <I>assignment-expression</I> in the initializer
has array type <SPAN style="font-weight:bold;background-color:#A0FFA0"><I>cv1</I></SPAN> <TT>A</TT> and
no <I>ref-qualifier</I> is present, <I>e</I> is defined
by...</P>

</BLOCKQUOTE>

<BR><BR><HR><A NAME="2509"></A><H4>2509.
  
<I>decl-specifier-seq</I> in <I>lambda-specifiers</I>
</H4><B>Section: </B>7.5.5.1&#160; [expr.prim.lambda.general]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Jens Maurer
 &#160;&#160;&#160;

 <B>Date: </B>2021-10-28


<P>(From editorial issue
<A HREF="https://github.com/cplusplus/draft/pull/2338">2338</A>.)</P>

<P>Use of <I>decl-specifier-seq</I> in the production for
<I>lambda-specifiers</I> is too general and should be
restricted.</P>

<P><B>Proposed resolution (December, 2021):</B></P>

<OL><LI><P>Change the grammar in 7.5.5.1 [expr.prim.lambda.general] as follows:</P></LI>

<UL><I>lambda-specifiers:</I>
<UL><I><SPAN style="text-decoration:line-through;background-color:#FFA0A0">decl</SPAN><SPAN style="font-weight:bold;background-color:#A0FFA0">lambda</SPAN>-specifier-seq<SUB>opt</SUB> noexcept-specifier<SUB>opt</SUB> attribute-specifier-seq<SUB>opt</SUB> trailing-return-type<SUB>opt</SUB></I>
</UL>
</UL>

<UL><SPAN style="font-weight:bold;background-color:#A0FFA0"><I>lambda-specifier:</I></SPAN>
<UL><SPAN style="font-weight:bold;background-color:#A0FFA0"><TT>consteval</TT></SPAN><BR>
<SPAN style="font-weight:bold;background-color:#A0FFA0"><TT>constexpr</TT></SPAN><BR>
<SPAN style="font-weight:bold;background-color:#A0FFA0"><TT>mutable</TT></SPAN>
</UL>
</UL>

<UL><SPAN style="font-weight:bold;background-color:#A0FFA0"><I>lambda-specifier-seq:</I></SPAN>
<UL><SPAN style="font-weight:bold;background-color:#A0FFA0"><I>lambda-specifier</I></SPAN><BR>
<SPAN style="font-weight:bold;background-color:#A0FFA0"><I>lambda-specifier lambda-specifier-seq</I></SPAN>
</UL>
</UL>

<LI><P>Change 7.5.5.1 [expr.prim.lambda.general] paragrap 3 as follows:</P></LI>

<BLOCKQUOTE>

<SPAN style="text-decoration:line-through;background-color:#FFA0A0">In the <I>decl-specifier-seq</I> of
the <I>lambda-declarator</I>, each <I>decl-specifier</I>
shall be one of <TT>mutable</TT>, <TT>constexpr</TT>, or
<TT>consteval</TT>.</SPAN> <SPAN style="font-weight:bold;background-color:#A0FFA0">A <I>lambda-specifier-seq</I>
shall contain at most one of each <I>lambda-specifier</I>
and shall not contain both <TT>constexpr</TT> and
<TT>consteval</TT>.</SPAN> If the <I>lambda-declarator</I>
contains an explicit object parameter
(9.3.4.6 [dcl.fct]), then
no <I><SPAN style="text-decoration:line-through;background-color:#FFA0A0">decl</SPAN><SPAN style="font-weight:bold;background-color:#A0FFA0">lambda</SPAN>-specifier</I> in
the <I><SPAN style="text-decoration:line-through;background-color:#FFA0A0">decl</SPAN><SPAN style="font-weight:bold;background-color:#A0FFA0">lambda</SPAN>-specifier-seq</I>
shall be <TT>mutable</TT>.

</BLOCKQUOTE>

</OL>

<BR><BR><HR><A NAME="2511"></A><H4>2511.
  
cv-qualified bit-fields
</H4><B>Section: </B>11.4.10&#160; [class.bit]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Aaron Ballman
 &#160;&#160;&#160;

 <B>Date: </B>2021-09-15


<P>According to 11.4.10 [class.bit] paragraph 1,</P>

<BLOCKQUOTE>

A bit-field shall have integral or enumeration type

</BLOCKQUOTE>

<P>This apparently does not allow for cv-qualification in a
bit-field type.</P>

<P><B>Notes from the December, 2021 meeting:</B></P>

<P>As of N4901, there is no longer an issue regarding
the integral types; 6.8.2 [basic.fundamental] paragraph 11
says,</P>

<BLOCKQUOTE>

The character types, <TT>bool</TT>, the signed and unsigned
integer types, and cv-qualified versions
(6.8.4 [basic.type.qualifier]) thereof, are collectively
termed <I>integral types</I>.

</BLOCKQUOTE>

<P><B>Proposed resolution (December, 2021):</B></P>

<BLOCKQUOTE>

A bit-field shall have integral or <SPAN style="font-weight:bold;background-color:#A0FFA0">(possibly
cv-qualified)</SPAN> enumeration type

</BLOCKQUOTE>

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