<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1753</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="1753"></A><H4>1753.
  
<I>decltype-specifier</I> in <I>nested-name-specifier</I> of destructor
</H4>
<B>Section: </B>6.5.5&#160; [<A href="https://wg21.link/basic.lookup.qual">basic.lookup.qual</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>John Spicer
 &#160;&#160;&#160;

 <B>Date: </B>2013-09-18<BR>


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

<P>One of the forms of <I>pseudo-destructor-name</I> is</P>

<UL>
<I>nested-name-specifier<SUB>opt</SUB></I> <TT>~</TT> <I>type-name</I>
</UL>

<P>Presumably the intent of this form is to allow
the <I>nested-name-specifier</I> to designate a namespace; otherwise
the</P>

<UL>
<I>nested-name-specifier<SUB>opt</SUB> type-name</I> <TT>:: ~</TT> <I>type-name</I>
</UL>

<P>production would be used.</P>

<P>Since one of the forms of <I>nested-name-specifier</I> is</P>

<UL>
<I>decltype-specifier</I> <TT>::</TT>
</UL>

<P>one can write something like <TT>p-&gt;decltype(x)::~Y()</TT>.
However, the lookup rules in 6.5.5 [<A href="https://wg21.link/basic.lookup.qual#6">basic.lookup.qual</A>] paragraph 6 are
inappropriate for the <I>decltype-specifier</I> case:</P>

<BLOCKQUOTE>

If a <I>pseudo-destructor-name</I> (_N4778_.7.6.1.4 [<A href="https://wg21.link/expr.pseudo">expr.pseudo</A>]) contains
a <I>nested-name-specifier</I>, the <I>type-name</I>s are looked up as
types in the scope designated by the <I>nested-name-specifier</I>.

</BLOCKQUOTE>

<P>Since this form appears to be useless (use of a <I>decltype-specifier</I>
is permitted after a <TT>~</TT>, but only with no
<I>nested-name-specifer</I> &#8212; but see
<A HREF="1586.html">issue 1586</A>), perhaps it should be made
ill-formed.</P>

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

<P>Change the grammar in 7.6.1 [<A href="https://wg21.link/expr.post#1">expr.post</A>] paragraph 1 as
follows:</P>

<UL>
<I>pseudo-destructor-name:</I>
<UL>
<I>nested-name-specifier<SUB>opt</SUB> type-name</I> <TT>:: ~</TT> <I>type-name</I><BR>
<I>nested-name-specifier</I> <TT>template</TT> <I>simple-template-id</I> <TT>:: ~</TT> <I>type-name</I><BR>
<DEL><I>nested-name-specifier<SUB>opt</SUB></I></DEL> <TT>~</TT> <I>type-name</I><BR>
<TT>~</TT> <I>decltype-specifier</I>
</UL>
</UL>

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