<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1852</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="1852"></A><H4>1852.
  
Wording issues regarding <TT>decltype(auto)</TT>
</H4>
<B>Section: </B>9.2.9.3&#160; [<A href="https://wg21.link/dcl.type.simple">dcl.type.simple</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Daveed Vandevoorde
 &#160;&#160;&#160;

 <B>Date: </B>2014-02-04<BR>


<P>[Moved to DR at the November, 2014 meeting.]</P>

<P>According to 9.2.9.3 [<A href="https://wg21.link/dcl.type.simple#2">dcl.type.simple</A>] paragraph 2,</P>

<BLOCKQUOTE>

The <TT>auto</TT> specifier is a placeholder for a type to be deduced
(9.2.9.7 [<A href="https://wg21.link/dcl.spec.auto">dcl.spec.auto</A>]).

</BLOCKQUOTE>

<P>This is not true when <TT>auto</TT> appears in the
<TT>decltype(auto)</TT> construct.</P>

<P>On a slightly related wording issue, 9.2.9.7 [<A href="https://wg21.link/dcl.spec.auto#2">dcl.spec.auto</A>] paragraph 2
says,</P>

<BLOCKQUOTE>

The <TT>auto</TT> and <TT>decltype(auto)</TT> <I>type-specifier</I>s
designate a placeholder type that will be replaced later, either by
deduction from an initializer or by explicit specification with
a <I>trailing-return-type</I>.

</BLOCKQUOTE>

<P>This could be read as implying that <TT>decltype(auto)</TT>
can be used to introduce a function with a
<I>trailing-return-type</I>, contradicting 9.3.4.6 [<A href="https://wg21.link/dcl.fct#2">dcl.fct</A>] paragraph 2,
 which requires that a function declarator with a
<I>trailing-return-type</I> must have <TT>auto</TT> as the sole
type specifier.</P>

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

<OL>
<LI><P>Change 9.2.9.3 [<A href="https://wg21.link/dcl.type.simple#2">dcl.type.simple</A>] paragraph 2 as follows:</P></LI>

<BLOCKQUOTE>

The <INS><I>simple-type-specifier</I></INS> <TT>auto</TT> <DEL>specifier</DEL>
is a placeholder for a type to be deduced
(9.2.9.7 [<A href="https://wg21.link/dcl.spec.auto">dcl.spec.auto</A>]). The other <I>simple-type-specifier</I>s...

</BLOCKQUOTE>

<LI><P>Change 9.2.9.7 [<A href="https://wg21.link/dcl.spec.auto#1">dcl.spec.auto</A>] paragraph 1 as follows:</P></LI>

<BLOCKQUOTE>

<P>The <TT>auto</TT> and <TT>decltype(auto)</TT> <I>type-specifier</I>s
<INS>are used to</INS> designate a placeholder type that will be replaced
later<DEL>, either</DEL> by deduction from an initializer <DEL>or by
explicit specification with a <I>trailing-return-type</I></DEL>. The
<TT>auto</TT> <I>type-specifier</I> is also used <INS>to introduce a
function type having a <I>trailing-return-type</I> or</INS> to signify that
a lambda is a generic lambda.</P>

</BLOCKQUOTE>

</OL>

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