<html>
<head>
<title>Core Issue 355: Global-scope :: in elaborated-type-specifier</title>

<style type="text/css">
  ins { text-decoration:none; font-weight:bold; background-color:#A0FFA0 }
  del { text-decoration:line-through; background-color:#FFA0A0 }
  strong { font-weight: inherit; color: #2020ff }
</style>
</head>

<body>
Jens Maurer<br/>
N3259=11-0029<br/>
2011-03-22

<h1>Core Issue 355: Global-scope :: in <em>elaborated-type-specifier</em></h1>

This paper presents the wording changes relative to the Working Paper N3242
to address core issue 355 (see also FCD comments US 2 and CH 1).
Due to the volume of the changes, they were not integrated into
the core issues list.
<p>

In section 3.4.3 basic.lookup.qual paragraph 6, change the grammar
snippet as follows:
<blockquote>
<pre>
<del>::<sub>opt</sub></del> <em>nested-name-specifier</em><sub>opt</sub> <em>class-name</em> :: ~ <em>class-name</em>
<pre>
</blockquote>

In section 3.4.3.2 namespace.qual, replace as indicated:
<blockquote>
If the <em>nested-name-specifier</em> of a <em>qualified-id</em>
nominates a namespace, the name specified after the
<em>nested-name-specifier</em> is looked up in the scope of the
namespace<del>,</del>

<ins>.  If a <em>qualified-id</em> starts with
<code>::</code>, the name after the <code>::</code> is looked up
in the global namespace.

In either case,</ins> <del>except that</del> the names in a
<em>template-argument</em> of
a <em>template-id</em> are looked up in the context in which the
entire <em>postfix-expression</em> occurs.
</blockquote>

Strike 5.1.1 expr.prim.general paragraph 3 entirely:
<blockquote>
<del>The operator <code>::</code> followed by an <em>identifier</em>,
a <em>qualified-id</em>, an <em>operator-function-id</em>, or a
<em>literal-operator-id</em> is a <em>primary-expression</em>. Its
type is specified by the declaration of the <em>identifier</em>,
<em>qualified-id</em>, <em>operator-function-id</em>, or
<em>literal-operator-id</em>. The result is the entity denoted by the
<em>identifier</em>, <em>qualified-id</em>,
<em>operator-function-id</em>, or <em>literal-operator-id</em>. The
result is an lvalue if the entity is a function or variable and a
prvalue otherwise.
The <em>identifier</em>, <em>qualified-id</em>,
<em>operator-function-id</em>, or <em>literal-operator-id</em> shall
have global namespace scope or be visible in global scope because of a
using-directive (7.3.4 namespace.udir). [ Note: the use of
<code>::</code> allows an entity declared in the global namespace to
be referred to even if its name has been hidden (3.4.3
basic.lookup.qual). -- end note ]</del>
</blockquote>

<em>Drafting note: It's covered by 5.1.1p7 (type, lvalue-ness,
member-ness, reference to 3.4.3.2) and 3.4.3.2 (qualified lookup for
namespace members).</em>
<p>

In section 5.1.1 expr.prim.general paragraph 6, change the grammar
snippet as follows:
<blockquote>
<pre>
<em>qualified-id</em>:
       <del>::<sub>opt</sub></del> <em>nested-name-specifier</em> template<sub>opt</sub> <em>unqualified-id</em>
       :: <em>identifier</em>
       :: <em>operator-function-id</em>
       :: <em>literal-operator-id</em>
       :: <em>template-id</em>

<em>nested-name-specifier</em>:
       <ins>::<sub>opt</sub></ins> <em>type-name</em> ::
       <ins>::<sub>opt</sub></ins> <em>namespace-name</em> ::
       <em>decltype-specifier</em> ::
       <em>nested-name-specifier</em> <em>identifier</em> ::
       <em>nested-name-specifier</em> template<sub>opt</sub> <em>simple-template-id</em> ::
</pre>
</blockquote>


In section 5.1.1 expr.prim.general paragraph 7, replace as indicated:
<blockquote>
A <ins><code>::</code>, or a
</ins><em>nested-name-specifier</em> that names a namespace (7.3
basic.namespace),
<ins>in either case</ins> followed by the name of a member of
that namespace (or the name of a member of a namespace made visible by a
using-directive) is a <em>qualified-id</em>; 3.4.3.2 namespace.qual describes
name lookup for namespace members that appear in
<em>qualified-ids</em>. ...
</blockquote>

In section 5.1.1 expr.prim.general paragraph 9, replace as indicated:
<blockquote>
In a <em>qualified-id</em>, if the
<del><em>id-expression</em></del> <ins><em>unqualified-id</em></ins>
is a <em>conversion-function-id</em>,
its <em>conversion-type-id</em> shall denote the same type in both the
context in which the entire <em>qualified-id</em> occurs and in the
context of the class denoted by the <em>nested-name-specifier</em>.
</blockquote>

In section 5.2 expr.post paragraph 1, change the grammar as indicated:
<blockquote>
<pre>
...
<em>pseudo-destructor-name</em>:
      <del>::<sub>opt</sub></del> <em>nested-name-specifier</em><sub>opt</sub> <em>type-name</em> :: ~ <em>type-name</em>
      <del>::<sub>opt</sub></del> <em>nested-name-specifier</em> template <em>simple-template-id</em> :: ~ <em>type-name</em>
      <del>::<sub>opt</sub></del> <em>nested-name-specifier</em><sub>opt</sub> ~ <em>type-name</em>
      ~ <em>decltype-specifier</em>
</pre>
</blockquote>

In section 5.2.4 expr.pseudo paragraph 2, change the grammar snippet
as indicated:
<blockquote>
<pre>
<del>::<sub>opt</sub></del><em>nested-name-specifier</em><sub>opt</sub> <em>type-name</em> :: ~ <em>type-name</em>
</pre>
</blockquote>

In 7.1.6.2 dcl.type.simple paragraph 1, change the grammar snippet
as indicated:
<blockquote>
<pre>
<em>simple-type-specifier</em>:
       <del>::<sub>opt</sub></del> <em>nested-name-specifier</em><sub>opt</sub> <em>type-name</em>
       <del>::<sub>opt</sub></del> <em>nested-name-specifier</em> template <em>simple-template-id</em>
       char
       ...
</pre>
</blockquote>


In 7.1.6.3 dcl.type.elab before paragraph 1, change the grammar snippet
as indicated:
<blockquote>
<pre>
<em>elaborated-type-specifier</em>:
      <em>class-key</em> <em>attribute-specifier</em><sub>opt</sub> <del>::<sub>opt</sub></del> <em>nested-name-specifier</em><sub>opt</sub> <em>identifier</em>
      <em>class-key</em> <del>::<sub>opt</sub></del> <em>nested-name-specifier</em><sub>opt</sub> template<sub>opt</sub> <em>simple-template-id</em>
      enum <del>::<sub>opt</sub></del> <em>nested-name-specifier</em><sub>opt</sub> <em>identifier</em>
</pre>
</blockquote>

In 7.1.6.3 dcl.type.elab paragraph 1, change the grammar snippet
as indicated:
<blockquote>
<pre>
<em>class-key</em> <em>attribute-specifier</em><sub>opt</sub> <em>identifier</em> ;
friend <em>class-key</em> ::<sub>opt</sub> <em>identifier</em> ;
friend <em>class-key</em> ::<sub>opt</sub> <em>simple-template-id</em> ;
friend <em>class-key</em> <del>::<sub>opt</sub></del> <em>nested-name-specifier</em> <em>identifier</em> ;
friend <em>class-key</em> <del>::<sub>opt</sub></del> <em>nested-name-specifier</em> template<sub>opt</sub> <em>simple-template-id</em> ;
</pre>
</blockquote>
<p>

In 7.3.2 namespace.alias paragraph 1, change the grammar snippet
as indicated:
<blockquote>
<pre>
<em>qualified-namespace-specifier</em>:
       <del>::<sub>opt</sub></del> <em>nested-name-specifier</em><sub>opt</sub> <em>namespace-name</em>
</blockquote>
</pre>

In 7.3.3 namespace.udecl paragraph 1, change the grammar snippet
as indicated:
<blockquote>
<pre>
<em>using-declaration</em>:
       using typename<sub>opt</sub> <del>::<sub>opt</sub></del> <em>nested-name-specifier</em> <em>unqualified-id</em> ;
       using :: <em>unqualified-id</em> ;
</blockquote>
</pre>

In section 7.3.4 namespace.udir before paragraph 1, change the grammar snippet
as indicated:

<blockquote>
<pre>
<em>using-directive</em>:
       <em>attribute-specifier</em><sub>opt</sub> using namespace <del>::<sub>opt</sub></del> <em>nested-name-specifier</em><sub>opt</sub> <em>namespace-name</em> ;
</blockquote>
</pre>

In clause 8 dcl.decl paragraph 4, change the grammar snippet
as indicated:
<blockquote>
<pre>
...
<em>ptr-operator</em>:
      * <em>attribute-specifier</em><sub>opt</sub> <em>cv-qualifier-seq</em><sub>opt</sub>
      & <em>attribute-specifier</em><sub>opt</sub>
      && <em>attribute-specifier</em><sub>opt</sub>
      <del>::<sub>opt</sub></del> <em>nested-name-specifier</em> * <em>attribute-specifier</em><sub>opt</sub> <em>cv-qualifier-seq</em><sub>opt</sub>
...
<em>declarator-id</em>:
      ...<sub>opt</sub> <em>id-expression</em>
      <del>::<sub>opt</sub></del> <em>nested-name-specifier</em><sub>opt</sub> <em>class-name</em>
</blockquote>
</pre>


In section 8.3.3 dcl.mptr paragraph 1, change the grammar snippet
as indicated:

<blockquote>
<pre>
<del>::<sub>opt</sub></del> <em>nested-name-specifier</em> * <em>attribute-specifier</em><sub>opt</sub> <em>cv-qualifier-seq</em><sub>opt</sub> <em>D1</em>
</blockquote>
</pre>

In section 9.2 class.mem before paragraph 1, change the grammar snippet
as indicated:

<blockquote>
<pre>
<em>member-declaration</em>:
     <em>attribute-specifier</em><sub>opt</sub> <em>decl-specifier-seq</em><sub>opt</sub> <em>member-declarator-list</em><sub>opt</sub> ;
     <em>function-definition</em> ;<sub>opt</sub>
     <del>::<sub>opt</sub></del> <em>nested-name-specifier</em> template<sub>opt</sub> <em>unqualified-id</em> ;
     <em>using-declaration</em>
     <em>static_assert-declaration</em>
     <em>template-declaration</em>
     <em>alias-declaration</em>
</blockquote>
</pre>


In clause 10 class.derived paragraph 1, change the grammar snippet
as indicated:
<blockquote>
<pre>
...
<em>class-or-decltype</em>:
       <del>::<sub>opt</sub></del> <em>nested-name-specifier</em><sub>opt</sub> <em>class-name</em>
       <em>decltype-specifier</em>
...
</pre>
</blockquote>

In section 14.6 temp.res paragraph 3, change the grammar snippet
as indicated:
<blockquote>
<pre>
<em>typename-specifier</em>:
      typename <del>::<sub>opt</sub></del> <em>nested-name-specifier</em> <em>identifier</em>
      typename <del>::<sub>opt</sub></del> <em>nested-name-specifier</em> template<sub>opt</sub> <em>simple-template-id</em>
</pre>
</blockquote>

</body>
</html>
