<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 482</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="482"></A><H4>482.
  
Qualified declarators in redeclarations
</H4>
<B>Section: </B>9.3.4&#160; [<A href="https://wg21.link/dcl.meaning">dcl.meaning</A>]
 &#160;&#160;&#160;

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

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

 <B>Date: </B>03 Nov 2004<BR>


<P>[Voted into the WP at the February, 2012 meeting;
moved to DR at the October, 2012 meeting.]</P>

<P>According to 9.3.4 [<A href="https://wg21.link/dcl.meaning#1">dcl.meaning</A>] paragraph 1,</P>

<BLOCKQUOTE>

A <I>declarator-id</I> shall not be qualified except for the
definition of a member function (11.4.2 [<A href="https://wg21.link/class.mfct">class.mfct</A>]) or
static data member (11.4.9 [<A href="https://wg21.link/class.static">class.static</A>]) outside of its
class, the definition or explicit instantiation of a function or
variable member of a namespace outside of its namespace, or the
definition of a previously declared explicit specialization
outside of its namespace, or the declaration of a friend function
that is a member of another class or namespace (11.8.4 [<A href="https://wg21.link/class.friend">class.friend</A>]). When the <I>declarator-id</I> is qualified, the
declaration shall refer to a previously declared member of the
class or namespace to which the qualifier refers...

</BLOCKQUOTE>

<P>This restriction prohibits examples like the following:</P>

<PRE>
    void f();
    void ::f();        // error: qualified declarator

    namespace N {
      void f();
      void N::f() { }  // error: qualified declarator
    }
</PRE>

<P>There doesn't seem to be any good reason for disallowing such
declarations, and a number of implementations accept them in
spite of the Standard's prohibition.  Should the Standard be
changed to allow them?</P>

<P><B>Notes from the April, 2006 meeting:</B></P>

<P>In discussing <A HREF="548.html">issue 548</A>, the CWG agreed
that the prohibition of qualified declarators inside their namespace
should be removed.</P>

<P><B>Proposed resolution (October, 2006):</B></P>

<P>Remove the indicated words from 9.3.4 [<A href="https://wg21.link/dcl.meaning#1">dcl.meaning</A>] paragraph 1:
</P>

<BLOCKQUOTE>

...An <I>unqualified-id</I> occurring in a <I>declarator-id</I> shall
be a simple <I>identifier</I> except for the declaration of some
special functions (11.4.8 [<A href="https://wg21.link/class.conv">class.conv</A>], 11.4.7 [<A href="https://wg21.link/class.dtor">class.dtor</A>], 12.4 [<A href="https://wg21.link/over.oper">over.oper</A>]) and for the declaration of
template specializations or partial specializations (13.9 [<A href="https://wg21.link/temp.spec">temp.spec</A>]). <DEL>A <I>declarator-id</I> shall not be qualified
except for the definition of a member function (11.4.2 [<A href="https://wg21.link/class.mfct">class.mfct</A>]) or static data member (11.4.9 [<A href="https://wg21.link/class.static">class.static</A>])
outside of its class, the definition or explicit instantiation of a
function or variable member of a namespace outside of its namespace,
or the definition of a previously declared explicit specialization
outside of its namespace, or the declaration of a friend function that
is a member of another class or namespace (11.8.4 [<A href="https://wg21.link/class.friend">class.friend</A>]).</DEL> When the <I>declarator-id</I> is qualified, the
declaration shall refer to a previously declared member of the class
or namespace to which the qualifier refers, and the member shall not
have been introduced by a <I>using-declaration</I> in the scope of the
class or namespace nominated by the <I>nested-name-specifier</I> of
the <I>declarator-id</I>...

</BLOCKQUOTE>

<P>[<I>Drafting note:</I> The omission of &#8220;outside of its
class&#8221; here does not give permission for redeclaration of
class members; that is still prohibited by 11.4 [<A href="https://wg21.link/class.mem#1">class.mem</A>] paragraph 1.
  The removal of the enumeration of the kinds of
declarations in which a <I>qualified-id</I> can appear does allow
a <TT>typedef</TT> declaration to use a <I>qualified-id</I>, which
was not permitted before; if that is undesirable, the prohibition can
be reinstated here.]</P>

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