<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 746</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="746"></A><H4>746.
  
Use of <TT>auto</TT> in <I>new-expression</I>s
</H4>
<B>Section: </B>9.2.9.7&#160; [<A href="https://wg21.link/dcl.spec.auto">dcl.spec.auto</A>]
 &#160;&#160;&#160;

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

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

 <B>Date: </B>18 November, 2008<BR><BR>


<A href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3086.html#UK95">N2800 comment
  UK&#160;95<BR></A>

<P>[Voted into WP at July, 2009 meeting.]</P>



<P>In listing the acceptable contexts in which the <TT>auto</TT>
specifier may appear, 9.2.9.7 [<A href="https://wg21.link/dcl.spec.auto">dcl.spec.auto</A>]) paragraph 4
mentions &#8220;the <I>type-specifier-seq</I> in a <I>new-type-id</I>&#8221;
but not the <I>type-id</I> in the parenthesized form; that is,
<TT>new auto (42)</TT> is well-formed but <TT>new (auto) (42)</TT> is
not.  This seems an unnecessary restriction, as well as contradicting
7.6.2.8 [<A href="https://wg21.link/expr.new#2">expr.new</A>] paragraph 2:</P>

<BLOCKQUOTE>

If the <TT>auto</TT> <I>type-specifier</I> appears in the
<I>type-specifier-seq</I> of a <I>new-type-id</I> or <I>type-id</I> of
a <I>new-expression</I>...

</BLOCKQUOTE>

<P>(See also <A HREF="496.html">issue 496</A>.)</P>

<P><B>Proposed resolution (March, 2009):</B></P>

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

<BLOCKQUOTE>

The <TT>auto</TT> <I>type-specifier</I> can also be used in declaring
an object in the <I>condition</I> of a selection statement
(8.5 [<A href="https://wg21.link/stmt.select">stmt.select</A>]) or an iteration statement (8.6 [<A href="https://wg21.link/stmt.iter">stmt.iter</A>]), in the <I>type-specifier-seq</I> in <DEL>a</DEL> <INS>the</INS>
<I>new-type-id</I> <INS>or <I>type-id</I> of a <I>new-expression</I></INS>
(7.6.2.8 [<A href="https://wg21.link/expr.new">expr.new</A>]), in a <I>for-range-declaration</I>...

</BLOCKQUOTE>

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