<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <meta name="generator" content="pandoc" />
  <title>P1787R5: Declarations and where to find them</title>
  <style type="text/css">code{white-space: pre;}</style>
  <style type="text/css">
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
  margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; }
code > span.dt { color: #902000; }
code > span.dv { color: #40a070; }
code > span.bn { color: #40a070; }
code > span.fl { color: #40a070; }
code > span.ch { color: #4070a0; }
code > span.st { color: #4070a0; }
code > span.co { color: #60a0b0; font-style: italic; }
code > span.ot { color: #007020; }
code > span.al { color: #ff0000; font-weight: bold; }
code > span.fu { color: #06287e; }
code > span.er { color: #ff0000; font-weight: bold; }
  </style>
  <style type="text/css">
  div.del, section.del { background: #fcd; }
  div.ins, section.ins { background: #bfa; }
  s, .del { background: #ff8888; margin-right: 0.15ch; }
  u, .ins { background: #88ff88; }
  /* from https://stackoverflow.com/a/32456613 */
  div > blockquote, body > blockquote {
      display: list-item;
      list-style-type: "- ";
  }
  pre {
  		margin-left: 1.2em;
  }
  .tony {
    border-collapse: collapse;
  }
  .tony > tbody > tr {
    vertical-align: top;
  }
  tr.hr, tr.hr {
    border-bottom: thin solid #60a0b0;  /* relies on collapse */
  }
  </style>
</head>
<body>
<div id="header">
<h1 class="title">P1787R5: Declarations and where to find them<!-- -*- c++-md -*- --></h1>
</div>
<p><em>Audience</em>: CWG<br />S. Davis Herring &lt;<script type="text/javascript">
<!--
h='&#108;&#x61;&#110;&#108;&#46;&#x67;&#x6f;&#118;';a='&#64;';n='&#104;&#x65;&#114;&#114;&#x69;&#110;&#x67;';e=n+a+h;
document.write('<a h'+'ref'+'="ma'+'ilto'+':'+e+'">'+e+'<\/'+'a'+'>');
// -->
</script><noscript>&#104;&#x65;&#114;&#114;&#x69;&#110;&#x67;&#32;&#x61;&#116;&#32;&#108;&#x61;&#110;&#108;&#32;&#100;&#x6f;&#116;&#32;&#x67;&#x6f;&#118;</noscript>&gt;<br />Los Alamos National Laboratory<br />August 13, 2020</p>
<!--
[dcl.link]: CWG1817
"hid{ing,den,es}": CWG186, [basic.link]/8, [stmt.dcl]/1, [dcl.decl]/3, [dcl.fct.default]/9, [namespace.udir]/6, /7, [namespace.udecl]/1, /4, /15, [class.name]/2, [class.copy.assign]/8, [class.conv]/5, [class.derived]/2, [class.virtual]/3, [class.base.init]/2, [class.free]/2, [over.dcl]/1, [over.call.object]/2, [over.match.copy]/1.2, [over.match.conv]/1.1, [over.match.ref]/1.1, [over.unary]/2, [over.ass]/1, [over.built]/1, [temp.local]/7, /8, /9
"namespace-?scope": [intro.compliance]/5, [basic.link]/5, /6, [basic.stc.dynamic.allocation]/1, [basic.stc.dynamic.deallocation]/1, [basic.start.main]/1, [basic.start.static]/3, [namespace.def]/1, [namespace.udir]/1, [namespace.udecl]/14, [dcl.link]/6, [class.mfct]/1, [class.ctor]/1.2, [class.dtor]/1.2, [class.static.data]/2, [class.friend]/6, [over.literal]/2, [temp.inject]/2, [except.handle]/12
"block-?scope": [basic.start.term]/3, /4, [expr.prim.lambda.closure]/2, [stmt.stmt]/7, [stmt.dcl]/4, /5, [dcl.fct.def.general]/7, [class.union.anon]/2
using-declaration: CWG360, [basic.def]/2.11, [basic.link]/11, [dcl.meaning]/1, [dcl.fct.default]/9, [dcl.enum]/4, [namespace.udecl], [module.interface]/5, [module.global]/2.6, [class.pre]/3, [class.copy.assign]/8, [over.load]/1, [over.match.funcs]/4, [over.literal]/2, [temp.res]/8.5.2
using-directive: [basic.link]/11, [namespace.def]/7, [namespace.udir], [over.load]/1
"[with]in the scope": [expr.prim.lambda.capture]/8, [expr.call]/7, [expr.unary.op]/4, [expr.await]/3.2, [expr.new]/11, /24, [stmt.ranged]/1.3.2, [dcl.meaning]/1, [dcl.init]/13, [dcl.fct.def.coroutine]/6, /9, /10, /12, [dcl.struct.bind]/4, [dcl.enum]/11, [namespace.udir]/2, [namespace.udecl]/18, [class.mfct]/4, [class.static]/2, [class.static.data]/2, [class.nest]/1, [class.union.anon]/1, [class.local]/1, [class.mi]/3, [class.access.spec]/5, [class.friend]/9, [class.base.init]/2, [class.base.init]/15, [class.free]/4, /6, [temp.param]/3, /16, [temp.names]/5, [temp.local]/2, [temp.expl.spec]/8
"in scope": [expr.prim.req]/4, [stmt.select]/2, [stmt.jump]/2, [stmt.dcl]/3, [dcl.pre]/4, [dcl.fct.default]/9 (twice), [dcl.fct.def.coroutine]/11, [dcl.enum]/11, [class.name]/2, /3, [class.nest]/1, [class.local]/1, [class.friend]/3, [over.dcl]/2, [over.call.func]/3, [temp.over.link]/5, [temp.res]/10, [temp.local]/3, [temp.nondep]/1, [temp.expl.spec]/5
"name lookup": CWG952, CWG1524=CWG591, [expr.prim.lambda.closure]/12, [expr.call]/4, [stmt.label]/1, [dcl.type.elab]/2, [namespace.udir]/2, /6, [namespace.udir]/7, [namespace.udecl]/1, [dcl.attr.grammar]/4, [module.interface]/7, [module.global]/2.3, /3, [module.context]/1, [module.reach]/1, /5, [class.mfct]/11, [class.ctor]/2, [class.static]/3, [class.union.anon]/1, [over.load]/1, [over.call.func]/3, [over.match.oper]/3.2, [temp.names]/2, [temp.arg]/7, [temp.mem]/6, [temp.over.link]/5, [temp.res]/2, [temp.dep]/4, [temp.dep.type]/6.2, /6.3.1, /8, [temp.dep.expr]/3, [temp.nondep]/1, [temp.inst]/17
"typedef": CWG1918, [dcl.typedef]/3, /4, /5, /6, /7, /9, [dcl.type.elab]/2, [module.interface]/5, /6, [class.access]/4
"same-?scope": [stmt.label]/1, [dcl.array]/3, [dcl.fct.default]/4, [class.local]/3, [over.pre]/1, [over.load]/1, [over.dcl]/1, /2, [temp.pre]/8, [temp.over.link]/7, [temp.inst]/12, [temp.deduct.guide]/3
"global": [basic.life]/6, [basic.stc.dynamic]/1, /2, [basic.stc.dynamic.allocation]/1, /4, [basic.stc.dynamic.deallocation]/1, /3.2, [basic.start.main]/1, /3, [expr.new]/10, /11, /12, /12.3, /24, [dcl.stc]/1, [dcl.meaning]/1, [dcl.fct.def.coroutine]/9, /10, [dcl.fct.def.coroutine]/12, [namespace.def]/1, [dcl.link]/6, [module.unit]/7.2, [class.mfct]/4, [class.static.data]/2, [class.union.anon]/2, [class.copy.elision]/2, [temp.dep]/4, [temp.inst]/11
"is looked up": [expr.prim.lambda.capture]/4, [expr.await]/3.2, [expr.new]/11, /24, [expr.delete]/9, [dcl.fct.def.coroutine]/9, /10, /12, [dcl.struct.bind]/4, [class.mfct]/4, [class.base.init]/2, [class.free]/4, /6, [over.call.func]/2, /3, [temp.dep.type]/8
"are looked up": [expr.prim.lambda.closure]/4, [stmt.ranged]/1.3.2, /1.3.3, [dcl.fct.default]/5, [dcl.fct.def.coroutine]/6
"translation unit": [basic.pre]/10, [basic.def]/1, [basic.def.odr]/1, /10, /12, [basic.link]/4.1, /4.3, /8, /11.1, [basic.stc.dynamic]/2, [dcl.fct.default]/4, [basic.namespace]/1, /3, [dcl.link]/5, /6, [module.interface]/7, [module.import]/2, [temp.pre]/7
"enclosing": CWG498
"introduc": [basic.pre]/5, [basic.def]/1, [basic.def]/2.5, [basic.def.odr]/9.2, /3, /4, [basic.link]/4, /9, /11, [basic.stc]/2, [basic.stc.dynamic]/2, [expr.prim.lambda.capture]/17, [expr.prim.req]/4, [stmt.iter]/3, [stmt.dcl]/1, /5, [dcl.typedef]/2, [dcl.type.elab]/2, [dcl.spec.auto]/4, [dcl.decl]/3, [dcl.meaning]/1, [dcl.fct.default]/9, [dcl.struct.bind]/1, [dcl.struct.bind]/2, /4, [dcl.enum]/4, [namespace.def]/2, [namespace.udecl]/1, /3, /11, /12, /14, /15, /16, /17, /18, /21, [module.interface]/2.4, /5, /7, [module.global]/2.5.8, [class.pre]/3, [class.name]/2, [class.mem]/3, /5.2, [class.copy.assign]/8, [class.copy.elision]/1.1, [over.match.funcs]/4.2, [temp.pre]/3, [temp.variadic]/8.3, [temp.dep.expr]/3.7, [temp.dep.candidate]/1, [temp.inject]/2
"ignor": [basic.link]/8, [stmt.label]/1, [namespace.udecl]/11, /20, [dcl.link]/4, /6, [class.derived]/2, [over.match.oper]/3.2
"different scopes": [basic.link]/11, [dcl.fct.default]/4
"access control": [class.access]/4, [over.dcl]/3
"multiple declarations": [basic.link]/11, [namespace.udecl]/10, [over.match.best]/4
"primary template name": [temp.class.spec]/7
"extend[ed/s]": [stmt.while]/2, [stmt.for]/3, [namespace.def]/2, /5, /6, [namespace.udir]/5, [class.copy.elision]/1.2, /3.2, [except.handle]/11, [cpp.replace]/10
"overload": CWG1038, [basic.def.odr]/3.1, /3.2, [basic.start.main]/2, [expr.unary.op]/6, [dcl.stc]/6, [dcl.type.decltype]/1.3, [namespace.udecl]/18, [module.global]/2.4, [class.access]/4, [over.dcl]/3, [over.match.call]/1, /2, [over.over]/1, [temp.names]/2, [temp.arg]/7, [temp.arg.nontype]/2.5, [temp.inst]/9, [temp.deduct.call]/6.1, /6.2, [temp.deduct.funcaddr]/1, [temp.deduct.type]/5.5, [temp.over]/1, [except.spec]/13.1
"all declarations": [basic.link]/12, [basic.link]/13, [dcl.fct]/10
"redeclar": CWG157, CWG1729 (#4/#5), [basic.def]/1, [basic.link]/8, /12, [stmt.label]/1, [stmt.iter]/3, [dcl.pre]/5, [dcl.typedef]/3, /4, /5, /6, [dcl.spec.auto]/13, [dcl.fct.default]/9, [dcl.enum]/3, [namespace.def]/4, [dcl.attr.deprecated]/3, [dcl.attr.unused]/4, [module.interface]/6, /7, /8, [module.global]/2.5.2, [class.name]/2, [class.mem]/5.2, [class.mfct]/1, [class.static.data]/3, [class.derived]/2, [class.access.spec]/4, [temp.class]/4, [temp.friend]/1.4, /4, [temp.local]/6, [temp.inst]/2
"any declaration": CWG1617=CWG2223, [dcl.align]/6
"reaching scope": (none)
"match": CWG1001 vs. CWG1322, CWG2037, CWG1665, CWG2, [basic.def.odr]/3.2, [basic.link]/8, [expr.new]/16, /23, /25, [over.dcl], [temp.class]/3, [temp.mem.func]/1, [temp.mem]/1, [temp.friend]/1.2, [temp.func.order]/1.3, [temp.explicit]/5, [temp.deduct.decl]/1, [except.ctor]/5
"deallocation": CWG1628, [basic.def.odr]/3.2, [expr.new]/24, /25, [expr.delete]/9, /10, /12, [dcl.fct.def.coroutine]/12, [class.dtor]/5.3, /13, [class.free]/4, /6, [temp.func.order]/1.3, [temp.deduct.decl]/1, [except.ctor]/5
"complete": CWG1092, IS...
"dependent": CWG2065, IS...
"nested-name-specifier": IS...
CWG1172 (what depends on a template parameter for purposes of equivalence?)


[basic.link]/12: friend declarations should be able to reach across modules
[expr.prim.id]/2: this is a good place for this, but wasn't it somewhere else too?
[class.dtor]/1.2: can this be unified with the rule for calling a destructor?
[class.union.anon]/2: redundant with something earlier about declaring namespace-scope anonymous unions static

the phrases "has namespace scope" and maybe "at namespace scope" should go
"not in scope" -> "not found" (but that doesn't seem dynamic)
A note would be good about how "X A::B(X)" looks up the two Xs differently but does access control on them in the same way.
Careful about declaring names to refer to entities vs. declaring entities to have names

Linkage:
per-overload linkage (ideally, entity-based linkage ([lex.separate]/2)), but each template is but one entity, and "static typedef" can't be seen via import
It would be nice to get rid of module linkage entirely (and just use exportedness), but watch out for [temp.dep.candidate]/1's usage of external linkage.
Can we replace "no linkage" with its more-linker-like value?  (E.g., for [module.interface]/7.)
Is it OK for a (de)allocation function to have module linkage?


-->

<h1 id="history">History</h1>
<p>r5:</p>
<ul>
<li>Rebased onto N4861 (significant for <em><code>boolean-testable</code></em>)</li>
<li>Allowed <em>using-declaration</em>s to refer to non-dependent conversion function templates</li>
<li>Limited hiding among conversion functions and dependent conversion function templates</li>
<li>Clarified and simplified conversion function template argument deduction</li>
<li>Allowed lookup in reachable class definitions</li>
<li>Excluded internal-linkage namespaces from “precedes” generally</li>
<li>Allowed <em>using-directive</em>s to operate across translation units (though exported only in header units)</li>
<li>Restored most <em>using-directive</em> wording as notes</li>
<li>Gave namespaces a locus</li>
<li>Clarified the status of the global namespace</li>
<li>Clarified the lookup for a namespace to extend</li>
<li>Clarified when declarations refer to the same entity, resolving CWG279, CWG338, CWG1884, CWG1898, CWG1252, CWG2062, and CWG1896</li>
<li>Preserved function-type language linkage in redeclarations</li>
<li>Restored language linkage for class members (with external linkage)</li>
<li>Restored explicit specialization/instantiation declarations for member functions</li>
<li>Restored initialization of an object via conversion to rvalue reference</li>
<li>Specified choice between <code>operator delete</code> and <code>operator delete[]</code> for a <em>delete-expression</em></li>
<li>Addressed non-<em>init-declarator</em> declarators and non-<em>identifier</em> <em>declarator-id</em>s</li>
<li>Defined declaration matching and lookup for <em>nested-name-specifier</em>s in redeclarations and specializations</li>
<li>Removed type-only lookup for <code>…::template A&lt;0&gt;::</code></li>
<li>Removed special name treatment for <code>friend struct S* f();</code></li>
<li>Allowed definitions of nested (local) types at block scope</li>
<li>Introduced “component name” to avoid recursing into template arguments or <em>decltype-specifier</em>s, replacing “appears as a type”</li>
<li>Simplified “name” to be nothing more than one of the relevant grammar non-terminals</li>
<li>Restricted “qualified name” to the name in question</li>
<li>Removed “closed context”, unresolving CWG325</li>
<li>Gave dependent class members priority over unqualified lookup, unresolving CWG1089</li>
<li>Made <code>operator=</code> dependent in any templated class</li>
<li>Separated “dependent call” from “dependent name”</li>
<li>Fixed dependent <em>using-declaration</em>s that refer to templates</li>
<li>Specified that dependent <em>using-declaration</em>s can be dependent members of the current instantiation</li>
<li>Clarified template argument deduction from declarations, resolving CWG271</li>
<li>Forbid use of a function with an undeduced return type without naming it</li>
<li>Specified default argument conflicts via different scopes rather than a common parameter</li>
<li>Reduced extent of several kinds of scopes</li>
<li>Rewrote ADL in terms of searches</li>
<li>Rephrased language linkage in terms of entities (properly including variables)</li>
<li>Accounted for entities declared with C language linkage belonging to multiple scopes</li>
<li>Expressed special <em>declarator-id</em>s as requirements</li>
<li>Merged [temp.inject] into [temp.friend]</li>
<li>Removed disused notion of exporting a name (as opposed to a declaration)</li>
<li>Restored explicit introduction of <em>class-specifier</em> names</li>
<li>Removed redundant class member function wording</li>
<li>Removed definition of inherited non-constructor members</li>
<li>Replaced “local variable” with “block variable”</li>
<li>Replaced some “anonymous union variable”s with “anonymous union member”</li>
<li>Rephrased usage of members of an anonymous union as an <em>id-expression</em> interpretation</li>
<li>Allowed anonymous unions to omit <code>static</code> in any internal-linkage namespace</li>
<li>Removed “-scope” adjectives in normative text</li>
<li>Fixed cross reference to removed subclause</li>
</ul>
<p>r4:</p>
<ul>
<li>Rebased onto N4849</li>
<li>Forbid <code>decltype(…)::~…</code></li>
<li>Restored block scope for most compound statements</li>
<li>Fixed scope of parameters of a function declaration</li>
<li>Fixed list of declarations and scope introducers</li>
<li>Removed “direct function lvalue” interpretation for a <em>template-id</em></li>
<li>Made scope-based rules for copy elision and implicit moves consistent</li>
<li>Removed truly final “point of declaration” usage</li>
<li>Clarified terminology (in particular, for enclosing scopes)</li>
<li>Added forward reference note for unusual declaration targets/binding</li>
<li>Removed or labeled deprecated <code>::template</code> in examples</li>
<li>Labeled [class.mfct.non-static] edits correctly</li>
</ul>
<p>r3:</p>
<ul>
<li>Rebased onto N4835</li>
<li>Added definition for “reachable from”</li>
<li>Restored Richard’s rule for cross-TU <em>using-declaration</em> conflicts</li>
<li>Generalized consistent-linkage rule for CWG1839</li>
<li>Corrected scope of function-local predefined variables</li>
<li>Updated all references to removed [basic.lookup.classref], resolving CWG255</li>
<li>Removed (remainder of) [class.this]</li>
<li>Removed “global object” term</li>
</ul>
<p>r2:</p>
<ul>
<li>Rebased onto N4830 (significant for <code>using</code> enumerators/enumerations)</li>
<li>Added a locus for a <em>concept-definition</em></li>
<li>Extended containing scopes into redeclarations of classes and enumerations</li>
<li>Properly limited cross-TU qualified lookup in namespaces</li>
<li>Fixed rules for conflicts between <em>using-declaration</em>⁠s</li>
<li>Renamed “anonymous union object” to “anonymous union variable”</li>
</ul>
<p>r1:</p>
<ul>
<li>Fixed reversed <em>using-directive</em> containment test</li>
<li>Updated <strong>signature</strong> definitions</li>
<li>Removed residual “point of declaration” usage</li>
<li>Fixed several uses of (new) “precede” to be (existing) “reachable”</li>
<li>Removed dangling “considered to refer to a template” reference</li>
<li>Used “be attached” for modules instead of (new, unrelated) “belong”</li>
<li>Included class templates with classes for all scope purposes</li>
<li>Distinguished entities from their associated scopes</li>
<li>Accounted for missing kinds of declarations</li>
<li>Removed superfluous definition of “denotes”</li>
<li>Disentangled “enclose” and “contain” definitions</li>
<li>Specified no lookup for <code>X</code> in <code>using X=...;</code></li>
<li>Allowed a <em>namespace-name</em> to be a member-qualified name</li>
<li>Allowed in-class lookup of <code>X</code> in <code>p-&gt;~X()</code> and <code>decltype(...)::~X()</code></li>
<li>Ignored non-type <code>X</code> in <code>struct N::X x;</code></li>
<li>Limited <code>this</code>/<code>static</code> prohibition with “current class”</li>
<li>Deprecated <code>A::template B</code> (as a template template argument or CTAD placeholder)</li>
<li>Allowed forward declarations of partial specializations</li>
<li>Removed mention of resolved issue</li>
<li>Added explanatory examples to aid review</li>
</ul>
<h1 id="introduction">Introduction</h1>
<p>The current descriptions of scope and name lookup are confusing, incomplete, and at times incorrect. [basic.scope] defines the word “scope” in two different ways, and then implicitly and indirectly specifies many aspects of name lookup with imperfect correspondence to the descriptions in [basic.lookup]. Lookup is often described for units of program text that may include multiple names and <code>&lt;</code> tokens that must be disambiguated, such as a <em>template-id</em> ([temp.dep]/2), <em>id-expression</em> ([over.call.func]/2), or <em>conversion-type-id</em> ([class.qual]/1.2). Namespaces, and the global namespace in particular, are inconsistently described as being one or many declarative regions ([basic.scope.namespace]/1, /4). There are dozens of Core issues on the subject; the general vagueness of the wording on the subject interferes with resolving them individually.</p>
<p>Modules significantly complicate the situation, principally by invalidating the tacit assumption that “every” lookup is restricted to preceding declarations in the same translation unit. There were already exceptions to that rule (<em>e.g.</em>, complete class contexts and <a href="http://wiki.edg.com/pub/Wg21belfast2019/CoreWorkingGroup/cwgMMMM.html"><em>using-declaration</em> conflicts</a>), which can then easily be (mis)read as applying to all contents of all translation units. Many rules, like those for lookup through a <em>using-directive</em>, do not make any mention of location at all, and so become ambiguous.</p>
<p>The similar process of associating a declaration with a previous declaration of the same name is also poorly specified. In particular, there is no consistent rule as to whether multiple declarations of the same name introduce distinct entities (that might conflict) or one entity (and might conflict).</p>
<p>This paper rewrites large sections of [basic.scope] and [basic.lookup] and parts of [temp.res] (and makes the requisite changes elsewhere to adapt to new definitions) to address these issues holistically. As discussed individually <a href="#issues">below</a>, 61 Core issues are resolved, as well as 19 points discussed on the reflector but not (yet) on the issues list. Many changes are (collectively) editorial, but their very number demands CWG review. Other changes generally formalize current implementation practice or, in the absence of implementation consensus, establish language consistency.</p>
<h1 id="approach">Approach</h1>
<p>To avoid redundant specification of scope and of name lookup, all description of where a name might be used ([basic.scope.block], [basic.scope.enum], <em>etc.</em>) is phrased merely in terms of the total extent of each scope where a name might be introduced. The scopes are always properly nested, although there are situations where unqualified lookup considers a scope that does not contain the point of the lookup. <!-- These are marked with "non-nested" in a comment. --> Explicit wording is introduced to require that lookup occur from a program point (replacing lookup “in the context” of something) and consider only previous declarations (except in complete-class contexts) and those made available by <code>import</code>. Most declarations are said to “bind” the names they introduce to themselves, replacing the notion of “not found by lookup”. To avoid confusion, the word “bind” is not used for describing locked-in lookup results as for default arguments (which can instead be described as being looked up from their declarations). The use of the word “visible” to indicate a declaration’s placement is avoided in normative text.</p>
<p>Several kinds of scope search are defined, and several kinds of qualified lookup are combined, to minimize redundancy in the definition of the lookup algorithms. The word “lookup” or phrase “look up” is used only for resolution of a name that is complete (at least in the simple context; it might be reused as a subroutine elsewhere). Lookup is defined for <em>nested-name-specifier</em>s in <em>declarator-id</em>s.</p>
<p>The descriptions of the algorithms generally favor local completeness at the expense of additional references to distant clauses (that would otherwise specify special cases for their respective language features). <!-- Exceptions are indicated by "remote" in a comment. --> Several rule restatements are turned into notes.</p>
<p>Every lookup is explicitly for a name, not an <em>id-expression</em> or <em>type-id</em>. Template arguments in an <em>id-expression</em> are addressed by defining which names are subject to qualified lookup and by excluding a <em>template-id</em> from being a name. Because labels interact with so little of the language, their identifiers are excluded from names and name lookup entirely.</p>
<p>To avoid confusion when a name is declared multiple times in a scope, careful distinction is made between a name and a declaration of that name. In particular, the “point of declaration” of a name (usually; [basic.scope.pdecl]/3 describes one for an unnamed class or enumeration) is replaced with the “locus” of a declaration.</p>
<p>The phrases “global name” and “global object” are removed to reduce the apparent special status of the global namespace (but “global scope” still exists because of its lack of syntax and as a shorthand).</p>
<p>Wording for the (possible) declaration of a class by an <em>elaborated-type-specifier</em> is removed from [basic.scope.pdecl]/7, [basic.lookup.elab]/2, [namespace.memdef]/3, and [class.friend]/11 and merged into [dcl.type.elab].</p>
<p>Richard’s proposal for <a href="http://lists.isocpp.org/core/2019/03/5795.php">“using-declarations &amp; {,!}export”</a> is followed: a (non-dependent) <em>using-declaration</em> is replaced with its referent(s) during name lookup rather than introducing additional declarations. Because it is consistent with that replacement, and for consistency with existing implementations, the inclusion of hidden type names by a member <em>using-declaration</em> is extended to those not in a class.</p>
<p>Declarations are deemed to declare the same entity when they must do so, categorizing conflicts between, say, <code>namespace x {}</code> and <code>template&lt;class&gt; concept x=true;</code> as inconsistent redeclarations. The word “redeclaration” is restricted to that case (and not a declaration of an existing name in a new scope). A procedure is specified for connecting a declaration of a qualified name or a template specialization to the original declaration of the name or template, aggregating wording scattered across [namespace.qual]/7, [basic.link]/6–7, [namespace.memdef]/2–3, [class.mfct]/1–3, [class.static.data]/3, [temp.class]/3, and [temp.class.spec.mfunc]/1. (This is not considered name lookup, partly because a mechanism other than overload resolution is used to resolve ambiguities.) Language linkage is respecified as being an attribute of an entity (or a function type), not a name.</p>
<h2 id="examples">Examples</h2>
<p>The lookup for the following examples is narrated to help CWG members relate old and new terminology. Cross references prefixed with + are to N4861 as edited here.</p>
<h3 id="using-directive-vs.-using-declaration"><em>using-directive</em> vs. <em>using-declaration</em></h3>
<pre class="sourceCode cpp"><code class="sourceCode cpp"><span class="kw">namespace</span> F {<span class="dt">float</span> x;}
<span class="kw">namespace</span> A {
  <span class="kw">namespace</span> I {<span class="dt">int</span> x;}
  <span class="kw">using</span> <span class="kw">namespace</span> I;
  <span class="kw">using</span> F::x;
  <span class="dt">void</span> f() {
    x=<span class="dv">0</span>;     <span class="co">// #1: error</span>
    A::x=<span class="dv">1</span>;  <span class="co">// #2: OK: F::x</span>
  }
}</code></pre>
<ol style="list-style-type: decimal">
<li>At #1, <code>x</code> is looked up as an unqualified name (+[basic.lookup.unqual]/4) via an unqualified search of the function block scope of <code>A::f</code> (/3).</li>
<li>When continuing on past the function parameter scope of <code>A::f</code> to the namespace scope of <code>A</code>, the unqualified search searches <code>A</code> and also every namespace contained by <code>A</code> and nominated by an active <em>using-directive</em> (/2).</li>
<li>The single <em>using-directive</em> is active in the block scope (/1), which is contained by <code>A</code>, as is <code>I</code>.</li>
<li>Therefore <code>A</code> and <code>I</code> are searched simultaneously.</li>
<li>The <em>using-declaration</em> is replaced with <code>F::x</code> (+[basic.lookup]/4), and the lookup is ambiguous ([basic.lookup]/1).</li>
</ol>
<!-- two lists -->

<ol style="list-style-type: decimal">
<li>At #2, <code>A</code> is looked up as an unqualified name. <code>x</code> is a qualified name (+[basic.lookup.qual]/2), so undergoes qualified name lookup (/3) which is just a search of <code>A</code>.</li>
<li>The search finds <code>F::x</code>, so the <em>using-directive</em> is not considered by +[namespace.qual]/1.</li>
</ol>
<h3 id="cwg459"><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#459">CWG459</a></h3>
<pre class="sourceCode cpp"><code class="sourceCode cpp"><span class="kw">struct</span> A {<span class="kw">using</span> T=<span class="dt">int</span>;};  <span class="co">// given</span>
<span class="kw">template</span>&lt;<span class="kw">class</span> T&gt;
<span class="kw">struct</span> B : A {
  <span class="dt">void</span> f() {T i;}
};</code></pre>
<ol style="list-style-type: decimal">
<li><code>T</code> (in the <em>template-head</em>), <code>B</code>, and <code>f</code> are not looked up (+[dcl.meaning]/3, +[class.pre]/1) because they introduce entities. (They may be used to recognize existing declarations being redeclared or with which there is a conflict, but they are not “evaluated” to an entity.)</li>
<li><code>A</code> is looked up as an unqualified name (+[basic.lookup.unqual]/4), ignoring non-type names ([class.derived]/2).</li>
<li><code>T</code> is looked up as an unqualified name when defining the class template <code>B</code> (+[temp.res]/1):
<ol style="list-style-type: decimal">
<li>Unqualified name lookup performs an unqualified search in the enclosing scope (+[basic.lookup.unqual]/3), which is the function block scope of <code>B::f</code> (+[basic.scope.block]/1).</li>
<li>For each enclosing scope, an unqualified search is just a search except when considering a namespace (+[basic.lookup.unqual]/2); a search is just a single search except when considering a class (template) (+[class.member.lookup]/1). The function block scope is neither and has no binding for <code>T</code> (and the parameter scope (+[basic.scope.param]/1) has only <code>__func__</code>).</li>
<li>The next enclosing scope is that of <code>B</code>; classes and class templates have scopes (+[basic.scope.class]/1). It is a class template, and a single search in it finds nothing ([class.member.lookup]/4), so its non-dependent base classes are considered (+[class.member.lookup]/5).</li>
<li>A single search in the scope of <code>A</code> finds the <em>typedef-name</em>.</li>
<li>The next enclosing scope is the template parameter scope to which the template parameter <code>T</code> belongs ([basic.scope.temp]/2), but it is never considered.</li>
</ol></li>
</ol>
<h3 id="calling-a-conversion-function">Calling a conversion function</h3>
<pre class="sourceCode cpp"><code class="sourceCode cpp"><span class="dt">auto</span> x = s.<span class="kw">operator</span> R T::*();</code></pre>
<ol style="list-style-type: decimal">
<li><code>x</code> is not looked up (+[dcl.meaning]/3).</li>
<li><code>s</code> is subject to normal unqualified lookup (+[basic.lookup.unqual]/4).</li>
<li>The names used in the <em>conversion-type-id</em> are looked up “in the same fashion as the <em>conversion-function-id</em>” (/5).</li>
<li>While that lookup can’t happen yet, the <em>conversion-function-id</em> is a member-qualified name (+[basic.lookup.qual]/2) and thus undergoes qualified lookup in the class of <code>s</code> (call it <code>S</code>; /3).</li>
<li>If <code>S::R</code> finds nothing, <code>R</code> is looked up as an unqualified name (+[basic.lookup.unqual]/5 again); <code>T</code> is considered the same way (separately), except that non-type names are ignored because of the following <code>::</code> ([basic.lookup.qual]/1).</li>
<li>Once the type named by the <em>conversion-type-id</em> is known ([class.conv.fct]/1), the <em>conversion-function-id</em> is looked up as described above (eventually reaching +[basic.lookup]/6 if any conversion function templates are involved).</li>
</ol>
<h3 id="calling-destructors">Calling destructors</h3>
<pre class="sourceCode cpp"><code class="sourceCode cpp"><span class="kw">struct</span> A {<span class="kw">using</span> X=A;};
<span class="kw">struct</span> B : A {<span class="kw">struct</span> X {};};
<span class="dt">void</span> f(B *b) {
  b-&gt;A::~X();            <span class="co">// error: A::X not considered</span>
}</code></pre>
<ol style="list-style-type: decimal">
<li>At #1, <code>A</code> undergoes qualified lookup in <code>B</code> (+[basic.lookup.qual]/3).</li>
<li>Because the terminal name (+[expr.prim.id.unqual]/2) of its <em>nested-name-specifier</em> is a (member-)qualified name (+[basic.lookup.qual]/2), <code>X</code> is looked up as <code>A</code> was (/5.1.2), which finds <code>B::X</code>.</li>
<li>Since that is not the lookup context <code>A</code>, <code>X</code> is then tried as an unqualified name (/5.2), but that finds nothing.</li>
</ol>
<h1 id="issues">Issues</h1>
<h2 id="definitions">Definitions</h2>
<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#554">CWG554</a> is resolved by using the word “scope” <em>instead of</em> “declarative region”, consistent with its very common use in phrases like “namespace scope”. The other uses of “scope” are implied by the explicit unqualified lookup algorithm. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2165">CWG2165</a> is resolved by removing the conflicting definition of it in [basic.scope].</p>
<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#405">CWG405</a> is resolved by stating that argument-dependent lookup (sometimes) occurs after an ordinary unqualified lookup (making statements like “finding a variable prevents argument-dependent lookup” formally correct).</p>
<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#36">CWG36</a> (which has the dubious distinction of having the earliest recorded date) is resolved by limiting the restriction in question to class scopes, where ambiguous accessibility would be a problem, since a <em>using-declaration</em> does not introduce declarations. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#418">CWG418</a> is resolved by trivial rephrasing along with that necessary for the new <em>using-declaration</em> interpretation. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#1960">CWG1960</a> (currently closed as NAD) is resolved by removing the rule in question (which is widely ignored by implementations and gives subtle interactions between <em>using-declaration</em>s).</p>
<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1291">CWG1291</a> and <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2396">CWG2396</a> are resolved by explicitly specifying how to look up names in a <em>conversion-type-id</em>.</p>
<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#600">CWG600</a> is resolved by explaining that accessibility affects naming a member in the sense of the ODR.</p>
<p>My proposed regularization of <em>try-block</em> containment in <a href="https://lists.isocpp.org/core/2020/02/8569.php">“Cases missed by P1825R0 (Merged wording for P0527R1 (Implicitly move from rvalue references in return statements) and P1155R3 (More implicit moves))”</a> is included in rewording the relevant bullets.</p>
<h2 id="lookup-completeness">Lookup completeness</h2>
<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#191">CWG191</a> and <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1200">CWG1200</a> are resolved by defining unqualified lookup in terms of every enclosing scope. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#536">CWG536</a> (long partially resolved) is resolved by specifying that unqualified lookup occurs for any kind of <em>unqualified-id</em> as an <em>id-expression</em>. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#399">CWG399</a> is resolved by explicitly appealing to the lookup for the last component of any suitable <em>nested-name-specifier</em>. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#562">CWG562</a> is resolved by defining lookup as occurring from a program point.</p>
<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#1906">CWG1906</a> (currently closed as NAD, perhaps because its proposed resolution suffered in attempting to fit the structure of [basic.lookup.unqual] rejected by CWG191) and <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2370">CWG2370</a> are resolved by Rachel’s regularization suggested in <a href="http://lists.isocpp.org/core/2019/05/6461.php">“Reconsidering CWG1906 and its friend CWG2370”</a>, which may be in conflict with the <a href="http://wiki.edg.com/bin/view/Wg21sandiego2018/CoreWorkingGroup#Core_issue_2370_friend_declarati">CWG opinion from San Diego</a>.</p>
<p>My proposed simplification for <a href="http://lists.isocpp.org/core/2019/03/5681.php">“Missing associated namespace for member template template arguments?”</a> is incorporated on the assumption that the failure to examine the namespace of an associated class is an oversight. (GCC and ICC, but not Clang or MSVC, accept the example in that message.)</p>
<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1822">CWG1822</a> is resolved by specifying that the body of a lambda remains in the surrounding (function parameter) scope.</p>
<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1894">CWG1894</a> and its duplicate <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2199">CWG2199</a> are resolved per Richard’s proposal for <a href="https://listarchives.isocpp.org/cgi-bin/wg21/message?wg=core&amp;msg=28415">“dr407 still leaves open questions about typedef / tag hiding”</a>, using generic conflicting-declaration rules even for <code>typedef</code>, and discarding a redundant <em>typedef-name</em> when looking up an <em>elaborated-type-specifier</em>.</p>
<p>The suggestion in [namespace.udir]/5 that declarations become available only after a <em>namespace-definition</em> is removed.</p>
<p>Jens’ interpretation of <a href="http://lists.isocpp.org/core/2019/04/6024.php">“On beyond CWG372”</a> is included as a note (<em>cf.</em> Richard’s <a href="http://lists.isocpp.org/core/2019/04/6026.php">proposed restriction</a>)<!-- FIXME: which would obviate the need for the *base-specifier* note -->. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#607">CWG607</a> is resolved by looking up unqualified names in a <em>mem-initializer-id</em> from outside the parameter scope. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1837">CWG1837</a> is resolved by restricting <code>this</code> to referring to the innermost enclosing class.</p>
<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2007">CWG2007</a> is resolved by skipping unqualified lookup for operators that must be member functions. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#255">CWG255</a> (partially resolved by <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3778.html">N3778</a> is resolved by generally specifying the restriction to usual deallocation functions.</p>
<p>Richard’s correction to template parameter scope for constrained template template parameters for <a href="http://lists.isocpp.org/core/2019/05/6122.php">“CWG186 is NAD (or ‘Resolved’)”</a> is incorporated. His correction to function parameter scope for non-defining declarations in <a href="https://lists.isocpp.org/core/2020/01/8363.php">“Using a function parameter in a requires clause”</a> is applied directly.</p>
<p>The missing point of declaration for a concept identified by Andrew in <a href="https://lists.isocpp.org/core/2019/09/7238.php">“recursive concepts”</a> is supplied (without any prohibition on self-referential concepts).</p>
<h2 id="complete-class-context">Complete-class context</h2>
<p>The intent for <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2335">CWG2335</a> (contra those of the older <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1890">CWG1890</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1626">CWG1626</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1255">CWG1255</a>, and <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#287">CWG287</a>) is supported by retaining the unrestricted forward lookup in complete-class contexts (despite current implementation behavior for non-templates). <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#361">CWG361</a> is partially resolved by that confirmation; the rest must be addressed along with CWG2335. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2331">CWG2331</a> is resolved by defining lookup from complete-class contexts and out-of-line member definitions. The rest of <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2009">CWG2009</a> is resolved by making it ill-formed NDR for forward lookup outside a complete-class context to change the results (before overload resolution, to avoid differences in instantiation). A workaround for the practical issue of <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#325">CWG325</a> is introduced by generalizing the <code>template</code> prefix to support lookup in an incomplete class. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1635">CWG1635</a> is partially resolved by also making template default arguments a complete-class context.</p>
<h2 id="declaration-matching">Declaration matching</h2>
<p>My clarification in <a href="http://lists.isocpp.org/core/2019/06/6614.php">“Where can namespace-scope functions and variables be redeclared?”</a> is applied, resolving <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1821">CWG1821</a>.</p>
<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1820">CWG1820</a> is resolved by requiring that a qualified <em>declarator-id</em> declare an entity. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#386">CWG386</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1839">CWG1839</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1818">CWG1818</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2058">CWG2058</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1900">CWG1900</a>, and Richard’s observation in <a href="http://lists.isocpp.org/core/2017/01/1604.php">“are non-type names ignored in a class-head-name or enum-head-name?”</a> are resolved by describing the limited lookup that occurs for a <em>declarator-id</em>, including the changes in Richard’s <a href="http://wiki.edg.com/pub/Wg21cologne2019/CoreWorkingGroup/cwg1839.html">proposed resolution for CWG1839</a> (which also resolves CWG1818 and what of CWG2058 was not resolved along with CWG2059) and rejecting the example from <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1477">CWG1477</a>. Consistent linkage is preserved by strengthening [dcl.stc]/6. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#138">CWG138</a> is resolved according to <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2000/n1229.html">N1229</a>.</p>
<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#563">CWG563</a> is resolved by simplifications that follow its suggestions.</p>
<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#110">CWG110</a> is resolved by reducing the restriction in [temp.pre] to a note (matching the behavior of GCC, Clang, and ICC). <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1898">CWG1898</a> is resolved by explicitly using the defined term parameter-type-list. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1884">CWG1884</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#279">CWG279</a>, and <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#338">CWG338</a> are resolved by defining entity identity explicitly. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1252">CWG1252</a> is resolved by defining it for member and non-member functions as consistently as is appropriate. The incomplete consideration of constraints identified by Barry in <a href="https://lists.isocpp.org/core/2020/05/9114.php">“Using-declaration with constrained members ([namespace.udecl]/14)”</a> is addressed by reusing the general function identity definition. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2062">CWG2062</a> and <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1896">CWG1896</a> are resolved by specifying consistency requirements for all entities.</p>
<h2 id="modules">Modules</h2>
<p>Richard’s proposed resolution for <a href="http://lists.isocpp.org/core/2019/04/6014.php">“missing restriction on private-module-fragment”</a> is incorporated.</p>
<p>Nathan’s question about <code>export using</code> in <a href="http://lists.isocpp.org/core/2019/03/5773.php">“using-declarations &amp; {,!}export”</a> is avoided by not introducing synonyms that might or might not be exported. Richard’s <a href="http://wiki.edg.com/pub/Wg21belfast/CoreWorkingGroup/cwgMMMM.html">issue submission for <em>using-declaration</em> conflicts</a> is resolved by combining the generic notions of “conflicts with” and “precedes”.</p>
<h2 id="parsing">Parsing</h2>
<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1828">CWG1828</a> is resolved by disfavoring the interpretation of <code>::</code> as an entire <em>nested-name-specifier</em>. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1771">CWG1771</a> is resolved by describing the lookup of only an <em>identifier</em> preceding a <code>::</code> (as in the suggested resolution for CWG1828).</p>
<p>My proposal for <a href="https://lists.isocpp.org/core/2019/05/6171.php">“‘Down with template!’”</a> is incorporated by generalizing “type-id-only context” to “type-only context” and applying it to <code>template</code> as well as <code>typename</code>. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1835">CWG1835</a> is resolved by removing the special provision for <code>-&gt;</code>/<code>.</code> <em>identifier</em> <code>&lt;</code> in [basic.lookup.classref]/1, requiring that <code>template</code> be used to refer even to a non-member template in that position. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1908">CWG1908</a> is resolved per its suggestion of performing qualified lookup first and stopping if it produces a <em>template-id</em>, always taking <code>&lt;</code> to indicate one (per Richard’s proposal for <a href="http://lists.isocpp.org/core/2019/04/6042.php">“On beyond CWG1908”</a>). My further <a href="http://lists.isocpp.org/core/2019/04/6074.php">proposal</a> for parsing a <em>qualified-id</em> in a dependent class member access is applied. My proposal for <a href="http://lists.isocpp.org/core/2019/05/6257.php">“grammar ambiguities with non-simple template-ids”</a> is applied, allowing any kind of name to be considered to refer to a template, except for a <em>conversion-function-id</em> for which the rules would be more complicated despite never applying. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1841">CWG1841</a> is resolved by considering the injected-class-name of a class template to refer to a template.</p>
<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1616">CWG1616</a> is resolved by explicitly characterizing the forbidden case in terms of lookup results.</p>
<h2 id="templates">Templates</h2>
<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#459">CWG459</a> is not affected: base classes are still searched in unqualified lookup before template parameters are considered.</p>
<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1936">CWG1936</a> is resolved by expanding the definition of “dependent name” to include qualified names (<em>i.e.</em>, names previously said to be “a member of an unknown specialization”). <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1500">CWG1500</a> is resolved by further expanding it to include any <em>conversion-function-id</em> with a dependent type (and clarifying that dependent lookup takes place after substitution). My proposed regularization of <em>conversion-type-id</em> interpretation (which includes resolving <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2413">CWG2413</a>) in <a href="http://lists.isocpp.org/core/2019/05/6178.php">“‘Down with template!’”</a> and proposed rule for considering conversion function templates in <a href="http://lists.isocpp.org/core/2019/05/6339.php">“When are conversion function templates hidden?”</a> are incorporated. The assumption that a dependent qualified name names a type is disabled inside a <code>decltype</code> or array bound. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1028">CWG1028</a> is resolved by moving the “lookup from first declaration” rule from [temp.over.link]/5 to [temp.res]/1. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1907">CWG1907</a> is resolved by forbidding dependence on default (template) arguments not found by <em>lookup</em> for a dependent name.</p>
<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1829">CWG1829</a> is resolved by checking for direct members of a class that is the current instantiation. Nathan’s proposal of making the name <code>operator=</code> dependent in <a href="https://lists.isocpp.org/core/2018/11/5305.php">“When are class template assignment operators declared?”</a> is incorporated.</p>
<p>Prioritizing member lookup over unqualified lookup affirms that the templates in <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1089">CWG1089</a> are not functionally equivalent, leaving the matter as a missing condition for them to not be equivalent. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1478">CWG1478</a> is resolved per <a href="http://lists.isocpp.org/core/2019/05/6192.php">my interpretation</a> as independently suggested by Richard in <a href="http://lists.isocpp.org/core/2019/05/6247.php">“Implementation status of core issue 96”</a>.</p>
<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2070">CWG2070</a> is resolved by specifying that a dependent <em>using-declarator</em> is considered to name a constructor if and only if it ends with <code>B::B</code>. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#852">CWG852</a> is resolved by explicitly mentioning <em>using-declaration</em>⁠s in class templates (and making it diagnosable in most cases to refer to a class that is definitely not a base).</p>
<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1545">CWG1545</a> is resolved by interpreting entire friend declarations upon instantiation of an enclosing template.</p>
<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2213">CWG2213</a> is resolved by allowing an <em>elaborated-type-specifier</em> to contain a <em>simple-template-id</em> without <code>friend</code>.</p>
<p>Richard’s simplification in <a href="https://lists.isocpp.org/core/2020/02/8446.php">“Deduction failures and template-ids”</a> is applied as part of regularizing the interpretation of function names.</p>
<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#271">CWG271</a>, long partially resolved by the addition of [temp.deduct.decl], is resolved by replacing the explicit mentions of function parameters with cross references to it.</p>
<h1 id="wording">Wording</h1>
<p>Relative to N4861. <!-- TODO: include (some) removed paragraphs --></p>
<h2 id="intro.defs">[intro.defs]</h2>
<h3 id="defns.signature">[defns.signature]</h3>
<p>Change the definition (leaving the note):</p>
<blockquote>
<p><strong>signature</strong><br />〈function〉 name, parameter-type-list ([dcl.fct]), and enclosing namespace<s> (if any)</s></p>
</blockquote>
<h3 id="defns.signature.templ">[defns.signature.templ]</h3>
<p>Change:</p>
<blockquote>
<p><strong>signature</strong><br />〈function template〉 name, parameter-type-list ([dcl.fct]), enclosing namespace<s> (if any)</s>, return type, <em>template-head</em>, and trailing <em>requires-clause</em> ([dcl.decl]) (if any)</p>
</blockquote>
<h2 id="lex.ext">[lex.ext]</h2>
<p>Change paragraph 2:</p>
<blockquote>
<p>A <em>user-defined-literal</em> is treated as a call to a literal operator or literal operator template ([over.literal]). To determine the form of this call for a given <em>user-defined-literal</em> <em>L</em> with <em>ud-suffix</em> <em>X</em>, <u>first let <em>S</em> be the set of declarations found by unqualified lookup for </u>the <em>literal-operator-id</em> whose literal suffix identifier is <em>X</em><s> is looked up in the context of <em>L</em> using the rules for unqualified name lookup</s> ([basic.lookup.unqual]). <s>Let <em>S</em> be the set of declarations found by this lookup.</s> <em>S</em> shall not be empty.</p>
</blockquote>
<h2 id="basic">[basic]</h2>
<h3 id="basic.pre">[basic.pre]</h3>
<p>Change paragraph 4:</p>
<blockquote>
<p>A <em>name</em> is <s>a use of </s>an <em>identifier</em> ([lex.name]), <em>operator-function-id</em> ([over.oper]), <em>literal-operator-id</em> ([over.literal]), <u>or </u><em>conversion-function-id</em> ([class.conv.fct])<s>, or <em>template-id</em> ([temp.names]) that denotes an entity or label ([stmt.goto], [stmt.label])</s>.</p>
</blockquote>
<p>Change paragraph 5:</p>
<blockquote>
<p>Every name<s> that denotes an entity</s> is introduced by a <em>declaration</em><s>. Every name that denotes a label is introduced either by a <code>goto</code> statement ([stmt.goto]) or a <em>labeled-statement</em> ([stmt.label])</s><u>, which is a</u></p>
<ol style="list-style-type: decimal">
<li><u><em>declaration</em> or <em>member-declaration</em> ([dcl.pre], [class.mem])</u></li>
<li><u><em>init-declarator</em> ([dcl.decl]),</u></li>
<li><u><em>identifier</em> in a structured binding declaration ([dcl.struct.bind]) or <em>namespace-alias-definition</em> ([namespace.alias]),</u></li>
<li><u><em>condition</em> with a <em>declarator</em> ([stmt.stmt]),</u></li>
<li><u><em>member-declarator</em> ([class.mem]),</u></li>
<li><u><em>using-declarator</em> ([namespace.udecl]),</u></li>
<li><u><em>parameter-declaration</em> ([dcl.fct]),</u></li>
<li><u><em>type-parameter</em> ([temp.param]),</u></li>
<li><u><em>elaborated-type-specifier</em> that introduces a name ([dcl.type.elab]),</u></li>
<li><u><em>class-specifier</em> ([class.pre]),</u></li>
<li><u><em>enum-specifier</em> or <em>enumerator-definition</em> ([dcl.enum]),</u></li>
<li><u><em>exception-declaration</em> ([except.pre])</u></li>
<li><u>implicit declaration of an injected-class-name ([class.pre])</u>.</li>
</ol>
<p><u>[<em>Note</em>: The interpretation of a <em>for-range-declaration</em> produces one or more of the above ([stmt.ranged]). — <em>end note</em>] An entity <em>E</em> is <em>denoted</em> by the name (if any) that is introduced by a declaration of <em>E</em> or by a <em>typedef-name</em> introduced by a declaration specifying <em>E</em>.</u></p>
</blockquote>
<p>Change paragraph 9:</p>
<blockquote>
<p>Two names are <em>the same</em> if 1. they are <em>identifier</em>⁠s composed of the same character sequence, or 1. they are <em>operator-function-id</em>⁠s formed with the same operator, or 1. they are <em>conversion-function-id</em>⁠s formed with <s>the same</s><u>equivalent ([temp.over.link])</u> type<u>s</u>, or 1. <s>they are <em>template-id</em>⁠s that refer to the same class, function, or variable ([temp.type]), or</s> 1. they are <em>literal-operator-id</em>⁠s ([over.literal]) formed with the same literal suffix identifier.</p>
</blockquote>
<h3 id="basic.def">[basic.def]</h3>
<p>Change paragraph 1:</p>
<blockquote>
<p>A declaration ([dcl.dcl]) may <u>(re)</u>introduce one or more names<u> and/or entities</u> into a translation unit<s> or redeclare names introduced by previous declarations</s>. If so, the declaration specifies the interpretation and semantic properties of these names. <u>A declaration of an entity or <em>typedef-name</em> <em>X</em> is a <em>redeclaration</em> of <em>X</em> if another declaration of <em>X</em> is reachable from it ([module.reach]).</u> […]</p>
</blockquote>
<h3 id="basic.def.odr">[basic.def.odr]</h3>
<p>Change paragraph 4:</p>
<blockquote>
<p><u>A variable is named by an expression if the expression is an <em>id-expression</em> that denotes it.</u> A variable <code>x</code> <s>whose </s>name<u>d</u> <s>appears as</s><u>by</u> a potentially-evaluated expression <em>E</em> […]</p>
</blockquote>
<h3 id="basic.scope">[basic.scope]</h3>
<div class="del">
<h4>[basic.scope.declarative]</h4>
</div>
<p>Remove subclause, referring the old stable name to [basic.scope.scope] (added below). Remove the cross reference in [dcl.struct.bind]/1. Update the 2 surviving cross references (in [basic.def.odr]/9) to refer to [basic.scope.scope]. Replace the 8 surviving mentions of “declarative region” (in [basic.def.odr]/9, [expr.prim.id.unqual]/2, and [expr.prim.lambda.capture]/7) with “scope”.</p>
<div class="ins">
<h4>General [basic.scope.scope]</h4>
<p>Add subclause to front of [basic.scope], adapting a note and examples from [over.load] and [namespace.alias]/3:</p>
<blockquote>
<p>The declarations in a program appear in a number of <em>scopes</em> that are in general discontiguous. The <em>global scope</em> contains the entire program; every other scope <em>S</em> is introduced by a declaration, <em>parameter-declaration-clause</em>, statement, or <em>handler</em> (as described in the following subclauses of [basic.scope]) appearing in another scope which is thereby the <em>parent scope</em> of <em>S</em>. An <em>enclosing</em> scope at a program point is any scope that contains it; the smallest such scope is said to be the <em>immediate scope</em> at that point. A scope <em>intervenes</em> between a program point <em>P</em> and a scope <em>S</em> (that does not contain <em>P</em>) if it is or contains <em>S</em> but does not contain <em>P</em>.</p>
</blockquote>
<blockquote>
<p>Unless otherwise specified:</p>
<ol style="list-style-type: decimal">
<li>No two declarations (re)introduce the same entity.</li>
<li>A declaration <em>inhabits</em> the immediate scope at its locus ([basic.scope.pdecl]).</li>
<li>A declaration’s <em>target</em> scope is the scope it inhabits.</li>
<li>Any names (re)introduced by a declaration are <em>bound</em> to it in its target scope.</li>
</ol>
<p>An entity <em>belongs</em> to a scope <em>S</em> if <em>S</em> is the target scope of a declaration of the entity. [<em>Note</em>: Special cases include that:</p>
<ol style="list-style-type: decimal">
<li>Corresponding declarations with appropriate linkage declare the same entity ([basic.link]).</li>
<li>The declaration in a <em>template-declaration</em> inhabits the same scope as the <em>template-declaration</em>.</li>
<li>Friend declarations and declarations of qualified names and template specializations do not bind names ([dcl.meaning]); those with qualified names target a specified scope, and other friend declarations and certain <em>elaborated-type-specifier</em>⁠s ([dcl.type.elab]) target a larger enclosing scope.</li>
<li>Block-scope extern declarations target a larger enclosing scope but bind a name in their immediate scope.</li>
<li>The names of unscoped enumerators are bound in the two innermost enclosing scopes ([dcl.enum]).</li>
<li>A class’s name is also bound in its own scope ([class.pre]).</li>
<li>The names of the members of an anonymous union are bound in the union’s parent scope ([class.union.anon]).</li>
</ol>
<p>— <em>end note</em>]</p>
</blockquote>
<blockquote>
<p>Two declarations <em>correspond</em> if they (re)introduce the same name, both declare constructors, or both declare destructors, unless</p>
<ol style="list-style-type: decimal">
<li>either is a <em>using-declarator</em>, or</li>
<li>one declares a type (not a <em>typedef-name</em>) and the other declares a variable, non-static data member, enumerator, function, or function template, or</li>
<li>each declares a function or function template, except when
<ol style="list-style-type: decimal">
<li>both declare functions with the same parameter-type-list[<em>Footnote</em>: An implicit object parameter ([over.match.funcs]) is not part of the parameter-type-list. — <em>end footnote</em>], equivalent ([temp.over.link]) trailing <em>requires-clause</em>s (if any, except as specified in [temp.friend]), and, if both are non-static members, the same <em>cv</em>-qualifiers (if any) and <em>ref-qualifier</em> (if both have one), or</li>
<li>both declare function templates with equivalent parameter-type-lists, return types (if any), <em>template-head</em>s, and trailing <em>requires-clause</em>s (if any), and, if both are non-static members, the same <em>cv</em>-qualifiers (if any) and <em>ref-qualifier</em> (if both have one).</li>
</ol></li>
</ol>
<p>[<em>Note</em>: Declarations can correspond even if neither binds a name. [<em>Example</em>:</p>
<pre class="sourceCode cpp"><code class="sourceCode cpp"><span class="kw">struct</span> A {
  <span class="kw">friend</span> <span class="dt">void</span> f();    <span class="co">// #1</span>
};
<span class="kw">struct</span> B {
  <span class="kw">friend</span> <span class="dt">void</span> f() {}  <span class="co">// corresponds to, and defines, #1</span>
};</code></pre>
<p>— <em>end example</em>] — <em>end note</em>] [<em>Example</em>:</p>
<pre class="sourceCode cpp"><code class="sourceCode cpp"><span class="kw">typedef</span> <span class="dt">int</span> Int;
<span class="kw">enum</span> E : <span class="dt">int</span> { a };
<span class="dt">void</span> f(<span class="dt">int</span>);       <span class="co">// #1</span>
<span class="dt">void</span> f(Int) {}     <span class="co">// defines #1</span>
<span class="dt">void</span> f(E) {}       <span class="co">// OK: overloads #1</span>

<span class="kw">struct</span> X {
  <span class="dt">static</span> <span class="dt">void</span> f();
  <span class="dt">void</span> f() <span class="dt">const</span>;  <span class="co">// error: redeclaration</span>
  <span class="dt">void</span> g();
  <span class="dt">void</span> g() <span class="dt">const</span>;  <span class="co">// OK</span>
  <span class="dt">void</span> g() &amp;;      <span class="co">// error: redeclaration</span>
};</code></pre>
<p>— <em>end example</em>]</p>
</blockquote>
<blockquote>
<p>Two declarations <em>potentially conflict</em> if they correspond and cause their shared name to denote different entities ([basic.link]). The program is ill-formed if, in any scope, a name is bound to two declarations that potentially conflict and one precedes the other ([basic.lookup]). [<em>Note</em>: Overload resolution can consider potentially conflicting declarations found in multiple scopes (<em>e.g.</em>, via <em>using-directive</em>s or for operator functions), in which case it is often ambiguous. — <em>end note</em>] [<em>Example</em>:</p>
<pre class="sourceCode cpp"><code class="sourceCode cpp"><span class="dt">void</span> f() {
  <span class="dt">int</span> x,y;
  <span class="dt">void</span> x();  <span class="co">// error: different entity for x</span>
  <span class="dt">int</span> y;     <span class="co">// error: redefinition</span>
}
<span class="kw">enum</span> { f };  <span class="co">// error: different entity for ::f</span>
<span class="kw">namespace</span> A {}
<span class="kw">namespace</span> B = A;
<span class="kw">namespace</span> B = A;  <span class="co">// OK: no effect</span>
<span class="kw">namespace</span> B = B;  <span class="co">// OK: no effect</span>
<span class="kw">namespace</span> A = B;  <span class="co">// OK: no effect</span>
<span class="kw">namespace</span> B {}    <span class="co">// error: different entity for B</span></code></pre>
<p>— <em>end example</em>]</p>
</blockquote>
<blockquote>
<p>A declaration is <em>nominable</em> in a class, class template, or namespace <em>E</em> at a point <em>P</em> if it precedes <em>P</em>, does not inhabit a block scope, and its target scope is the scope associated with <em>E</em> or, if <em>E</em> is a namespace, any element of the inline namespace set of <em>E</em> ([namespace.def]). [<em>Example</em>:</p>
<pre class="sourceCode cpp"><code class="sourceCode cpp"><span class="kw">namespace</span> A {
  <span class="dt">void</span> f() {<span class="dt">void</span> g();}
  <span class="kw">inline</span> <span class="kw">namespace</span> B {
    <span class="kw">struct</span> S {
      <span class="kw">friend</span> <span class="dt">void</span> h();
      <span class="dt">static</span> <span class="dt">int</span> i;
    };
  }
}</code></pre>
<p>At the end of this example, the declarations of <code>f</code>, <code>B</code>, <code>S</code>, and <code>h</code> are nominable in <code>A</code>, but those of <code>g</code> and <code>i</code> are not. — <em>end example</em>]</p>
</blockquote>
<blockquote>
<p>When instantiating a templated entity ([temp.pre]), any scope <em>S</em> introduced by any part of the template definition is considered to be introduced by the instantiated entity and to contain the instantiations of any declarations that inhabit <em>S</em>.</p>
</blockquote>
</div>
<h4 id="basic.scope.pdecl">[basic.scope.pdecl]</h4>
<p>Change each paragraph 1–12: <!-- No > here; these are paragraph numbers. --></p>
<ol style="list-style-type: decimal">
<li><p>The <s><em>point of declaration</em> for</s><u><em>locus</em> of</u> a <s>name</s><u>declaration ([basic.pre]) that is a declarator</u> is immediately after <s>its</s><u>the</u> complete declarator ([dcl.decl])<s> and before its initializer (if any), except as noted below</s>. [<em>Example</em>:</p>
[…] — <em>end example</em>]</li>
<li><p>[<em>Note</em>: A name from an outer scope remains visible up to the <s>point</s><u>locus</u> of <u>the </u>declaration<s> of the name</s> that hides it. [<em>Example</em>:</p>
[…] — <em>end example</em>] — <em>end note</em>]</li>
<li>The <s>point</s><u>locus</u> of<s> declaration for a class or class template first declared by</s> a <em>class-specifier</em> is immediately after the <em>identifier</em> or <em>simple-template-id</em> (if any) in its <em>class-head</em> ([class.pre]). The <s>point</s><u>locus</u> of <s>declaration for an enumeration</s><u>an <em>enum-specifier</em> or <em>opaque-enum-declaration</em></u> is immediately after the <em>identifier</em> (if any) in <s>either its <em>enum-specifier</em> ([dcl.enum]) or its first <em>opaque-enum-declaration</em></s><u>it</u> ([dcl.enum])<s>, whichever comes first</s>. The <s>point</s><u>locus</u> of <s>declaration of an alias or alias template</s><u>an <em>alias-declaration</em> is</u> immediately <s>follows the <em>defining-type-id</em> to which the alias refers</s><u>after it</u>.</li>
<li>The <s>point of declaration</s><u>locus</u> of a <em>using-declarator</em> that does not name a constructor is immediately after the <em>using-declarator</em> ([namespace.udecl]).</li>
<li><p>The <s>point of declaration for an enumerator</s><u>locus of an <em>enumerator-definition</em></u> is immediately after it<s>s enumerator-definition</s>. [<em>Example</em>:</p>
[…] — <em>end example</em>]</li>
<li><u>[<em>Note</em>: </u>After the <s>point of </s>declaration of a class member, the member name can be <s>looked up</s><u>found</u> in the scope of its class<s>. [<em>Note</em>: This is true</s> even if the class is an incomplete class. […] — <em>end note</em>]</li>
<li><s>[…]</s><u>The locus of an <em>elaborated-type-specifier</em> that is a declaration ([dcl.type.elab]) is immediately after it.</u></li>
<li>The <s>point of declaration for</s><u>locus of</u> an injected-class-name<u> declaration</u> ([class.pre]) is immediately following the opening brace of the class definition.</li>
<li>The <s>point</s><u>locus</u> of<u> the implicit</u> declaration <s>for</s><u>of</u> a function-local predefined variable ([dcl.fct.def.general]) is immediately before the <em>function-body</em> of <s>a</s><u>its</u> function<u>’s</u> definition.</li>
<li>The <s>point</s><u>locus</u> of<u> the</u> declaration of a structured binding ([dcl.struct.bind]) is immediately after the <em>identifier-list</em> of the structured binding declaration.</li>
<li>The <s>point of declaration for the variable or the structured bindings declared in the</s><u>locus of a</u> for-range-declaration of a range-based for statement ([stmt.ranged]) is immediately after the <em>for-range-initializer</em>.</li>
<li><p>The <s>point of declaration for a template parameter</s><u>locus of a <em>template-parameter</em></u> is immediately after it<s>s complete <em>template-parameter</em></s>. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p></li>
</ol>
<p>Insert before paragraph 13:</p>
<div class="ins">
<blockquote>
<p>The locus of a <em>concept-definition</em> is immediately after its <em>concept-name</em> ([temp.concept]). [<em>Note</em>: The <em>constraint-expression</em> cannot use the <em>concept-name</em>. — <em>end note</em>]</p>
</blockquote>
<blockquote>
<p>The locus of a <em>namespace-definition</em> with an <em>identifier</em> is immediately after the <em>identifier</em>. [<em>Note</em>: An identifier is invented for an <em>unnamed-namespace-definition</em> ([namespace.unnamed]). — <em>end note</em>]</p>
</blockquote>
</div>
<p>[<em>Drafting note</em>: There is no normative wording yet corresponding to the <em>constraint-expression</em> note. — <em>end drafting note</em>]</p>
<p>Change paragraph 13:</p>
<blockquote>
<p>[<em>Note</em>: Friend declarations <s>refer to</s><u>may introduce</u> functions or classes that <s>are members of</s><u>belong to</u> the nearest enclosing namespace<u> or block scope</u>, but they do not <s>introduce new</s><u>bind</u> names <s>into that namespace</s><u>anywhere</u> ([<s>namespace.memdef</s><u>class.friend</u>]). Function declarations at block scope and variable declarations with the <code>extern</code> specifier at block scope <s>refer to declarations that are members of an</s><u>declare entities that belong to the nearest</u> enclosing namespace, but they do not <s>introduce new</s><u>bind</u> names <s>into that scope</s><u>in it</u>. — <em>end note</em>]</p>
</blockquote>
<h4 id="basic.scope.block">[basic.scope.block]</h4>
<div class="del">
Replace contents, retaining the example:
</div>
<div class="ins">
<blockquote>
<p>Each</p>
<ol style="list-style-type: decimal">
<li>selection or iteration statement ([stmt.select], [stmt.iter]),</li>
<li>substatement of such a statement,</li>
<li><em>handler</em> ([except.pre]), or</li>
<li>compound statement ([stmt.block]) that is not the <em>compound-statement</em> of a <em>handler</em>,</li>
</ol>
<p>introduces a <em>block scope</em> that includes that statement or <em>handler</em>. [<em>Note</em>: A substatement that is also a block has only one scope. — <em>end note</em>] A variable that belongs to a block scope is a <em>block variable</em>.</p>
</blockquote>
</div>
<p>Move the example from [stmt.for]/3 to here.</p>
<div class="ins">
<blockquote>
<p>If a declaration whose target scope is the block scope <em>S</em> of a</p>
<ol style="list-style-type: decimal">
<li><em>compound-statement</em> of a <em>lambda-expression</em>, <em>function-body</em>, or <em>function-try-block</em>,</li>
<li>substatement of a selection or iteration statement, or</li>
<li><em>handler</em> of a <em>function-try-block</em></li>
</ol>
<p>potentially conflicts with a declaration whose target scope is the parent scope of <em>S</em>, the program is ill-formed. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
</div>
<h4 id="basic.scope.param">[basic.scope.param]</h4>
<div class="del">
Replace contents:
</div>
<div class="ins">
<blockquote>
<p>A <em>parameter-declaration-clause</em> <em>P</em> introduces a <em>function parameter scope</em> that includes <em>P</em>. [<em>Note</em>: A function parameter cannot be used for its value within the <em>parameter-declaration-clause</em> ([dcl.fct.default]). — <em>end note</em>] If <em>P</em> is associated with a <em>declarator</em> and is preceded by a (possibly-parenthesized) <em>noptr-declarator</em> of the form <em>declarator-id</em> <em>attribute-specifier-seq</em><sub><em>opt</em></sub>, its scope extends to the end of the nearest enclosing <em>init-declarator</em>, <em>member-declarator</em>, <em>declarator</em> of a <em>parameter-declaration</em> or a <em>nodeclspec-function-declaration</em>, or <em>function-definition</em>, but does not include the locus of the associated <em>declarator</em>. [<em>Note</em>: In this case, <em>P</em> declares the parameters of a function (or a function or template parameter declared with function type). A member function’s parameter scope is nested within its class’s scope. — <em>end note</em>] If <em>P</em> is associated with a <em>lambda-declarator</em>, its scope extends to the end of the <em>compound-statement</em> in the <em>lambda-expression</em>. If <em>P</em> is associated with a <em>requirement-parameter-list</em>, its scope extends to the end of the <em>requirement-body</em> of the <em>requires-expression</em>. If <em>P</em> is associated with a <em>deduction-guide</em>, its scope extends to the end of the <em>deduction-guide</em>.</p>
</blockquote>
</div>
<div class="del">
<h4>[basic.funscope]</h4>
</div>
<p>Remove subclause, referring the stable name (which has no cross references) to [stmt.label].</p>
<h4 id="basic.scope.namespace">[basic.scope.namespace]</h4>
<div class="del">
Replace contents, adapting the example from [namespace.def]/4:
</div>
<div class="ins">
<blockquote>
<p>Any <em>namespace-definition</em> for a namespace <em>N</em> introduces a <em>namespace scope</em> that includes the <em>namespace-body</em> for every <em>namespace-definition</em> for <em>N</em>. For each redeclaration or specialization whose target scope is or is contained by the scope, the portion after the <em>declarator-id</em>, <em>class-head-name</em>, or <em>enum-head-name</em> is also included in the scope. The global scope is the namespace scope of the global namespace ([basic.namespace]). [<em>Example</em>:</p>
<pre class="sourceCode cpp"><code class="sourceCode cpp"><span class="kw">namespace</span> Q {
  <span class="kw">namespace</span> V { <span class="dt">void</span> f(); }
  <span class="dt">void</span> V::f() {  <span class="co">// in the scope of V</span>
    <span class="dt">void</span> h();    <span class="co">// declares Q::V::h</span>
  }
}</code></pre>
<p>— <em>end example</em>]</p>
</blockquote>
</div>
<h4 id="basic.scope.class">[basic.scope.class]</h4>
<div class="del">
Replace contents:
</div>
<div class="ins">
<blockquote>
<p>Any declaration of a class or class template <em>C</em> introduces a <em>class scope</em> that includes the <em>member-specification</em> of the <em>class-specifier</em> for <em>C</em> (if any). For each redeclaration or specialization whose target scope is or is contained by the scope, the portion after the <em>declarator-id</em>, <em>class-head-name</em>, or <em>enum-head-name</em> is also included in the scope. [<em>Note</em>: Lookup from a program point before the <em>class-specifier</em> of a class will find no bindings in the class scope. [<em>Example</em>:</p>
<pre class="sourceCode cpp"><code class="sourceCode cpp"><span class="kw">template</span>&lt;<span class="kw">class</span> D&gt;
<span class="kw">struct</span> B {
  D::type x;  <span class="co">// error: C::type not found</span>
};

<span class="kw">struct</span> A {<span class="kw">using</span> type=<span class="dt">int</span>;};
<span class="kw">struct</span> C : A,B&lt;C&gt; {};</code></pre>
<p>— <em>end example</em>] — <em>end note</em>]</p>
</blockquote>
</div>
<h4 id="basic.scope.enum">[basic.scope.enum]</h4>
<div class="del">
Replace contents:
</div>
<div class="ins">
<blockquote>
<p>Any declaration of an enumeration <em>E</em> introduces an <em>enumeration scope</em> that includes the <em>enumerator-list</em> of the <em>enum-specifier</em> for <em>E</em> (if any).</p>
</blockquote>
</div>
<h4 id="basic.scope.temp">[basic.scope.temp]</h4>
<div class="del">
Replace contents:
</div>
<div class="ins">
<blockquote>
<p>Each template <em>template-parameter</em> introduces a <em>template parameter scope</em> that includes the <em>template-head</em> of the <em>template-parameter</em>.</p>
</blockquote>
<blockquote>
<p>Each <em>template-declaration</em> <em>D</em> introduces a template parameter scope that extends from the beginning of its <em>template-parameter-list</em> to the end of the <em>template-declaration</em>. Any declaration outside the <em>template-parameter-list</em> that would inhabit that scope instead inhabits the same scope as <em>D</em>. [<em>Note</em>: Therefore, only template parameters belong to a template parameter scope. — <em>end note</em>]</p>
</blockquote>
</div>
<div class="del">
<h4>[basic.scope.hiding]</h4>
</div>
<p>Remove subclause, referring the stable name to [basic.lookup].</p>
<h3 id="basic.lookup">[basic.lookup]</h3>
<p>Change paragraph 1:</p>
<blockquote>
<p>[…] Name lookup associates the use of a name with a set of declarations ([basic.def]) of that name. <u>Unless otherwise specified, the program is ill-formed if no declarations are found.</u> If the declarations found by name lookup all denote functions or function templates, the declarations are said to form an <em>overload set</em>. <s>The</s><u>Otherwise, if the</u> declarations found by name lookup <s>shall either</s><u>do not</u> all denote the same entity<s> or form an overload set</s><u>, they are <em>ambiguous</em> and the program is ill-formed</u>. Overload resolution ([over.match], [over.over]) takes place after name lookup has succeeded. The access rules ([class.access]) are considered only once name lookup and function overload resolution (if applicable) have succeeded. Only after name lookup, function overload resolution (if applicable) and access checking have succeeded are the semantic properties introduced by the <s>name’s </s>declaration<u>s</u><s> and its reachable ([module.reach]) redeclarations</s> used <u>in </u>further <s>in expression </s>processing<s> ([expr])</s>.</p>
</blockquote>
<p>Insert before paragraph 2:</p>
<div class="ins">
<blockquote>
<p>A program point <em>P</em> <em>follows</em> any declaration in the same translation unit whose locus ([basic.scope.pdecl]) is before <em>P</em>. [<em>Note</em>: The declaration might appear in a scope that does not contain <em>P</em>. — <em>end note</em>]</p>
</blockquote>
<blockquote>
<p>A declaration <em>X</em> <em>precedes</em> a program point <em>P</em> in a translation unit <em>L</em> if <em>P</em> follows <em>X</em>, <em>X</em> inhabits a class scope and is reachable from <em>P</em>, or else <em>X</em> appears in a translation unit <em>D</em> and</p>
<ol style="list-style-type: decimal">
<li><em>P</em> follows a <em>module-import-declaration</em> or <em>module-declaration</em> that imports <em>D</em> (directly or indirectly), and</li>
<li><em>X</em> appears after the <em>module-declaration</em> in <em>D</em> (if any) and before the <em>private-module-fragment</em> in <em>D</em> (if any), and</li>
<li>either <em>X</em> is exported or <em>D</em> and <em>L</em> are part of the same module, and</li>
<li><em>X</em> does not inhabit a namespace with internal linkage or declare a name with internal linkage. [<em>Note</em>: Names declared by a <em>using-declaration</em> have no linkage. — <em>end note</em>]</li>
</ol>
</blockquote>
</div>
<p>Move the note (and example) from [basic.scope.namespace]/2 to the end of this paragraph.</p>
<div class="del">
Remove paragraphs 2 through 4.
</div>
<p>Append paragraphs:</p>
<div class="ins">
<blockquote>
<p>A <em>single search</em> in a scope <em>S</em> for a name <em>N</em> from a program point <em>P</em> finds all declarations that precede <em>P</em> to which any name that is the same as <em>N</em> ([basic.pre]) is bound in <em>S</em>. If any such declaration is a <em>using-declarator</em> whose terminal name ([expr.prim.id.unqual]) is not dependent ([temp.dep.type]), it is replaced by the declarations named by the <em>using-declarator</em> ([namespace.udecl]).</p>
</blockquote>
<blockquote>
<p>In certain contexts, only certain kinds of declarations are included. After any such restriction, any declarations of classes or enumerations are discarded if any other declarations are found. [<em>Note</em>: A type (but not a <em>typedef-name</em> or template) is therefore hidden by any other entity in its scope. — <em>end note</em>] However, if a lookup is <em>type-only</em>, only declarations of types and templates whose specializations are types are considered; furthermore, if declarations of a <em>typedef-name</em> and of the type to which it refers are found, the declaration of the <em>typedef-name</em> is discarded instead of the type declaration.</p>
</blockquote>
</div>
<h4 id="class.member.lookup">[class.member.lookup]</h4>
<p>Move to front of [basic.lookup], editing as follows:</p>
<div class="del">
Remove paragraph 1.
</div>
<p>Change paragraph 2:</p>
<blockquote>
<p><s>The</s><u>A <em>search</em> in a scope <em>C</em> for a name <em>N</em> from a program point <em>P</em> is a single search in <em>C</em> for <em>N</em> from <em>P</em> unless <em>C</em> is a class or class template, in which case the</u> following steps define the result of <s>a member name <code>f</code> in a class scope <code>C</code></s><u>the search</u>. <u>[<em>Note</em>: The result differs only if <em>N</em> is a <em>conversion-function-id</em> or if the single search would find nothing. — <em>end note</em>]</u></p>
</blockquote>
<p>Replace <code>f</code> with <em>N</em> and <code>C</code> with <em>C</em> in the following paragraphs.</p>
<p>Change paragraph 3:</p>
<blockquote>
<p>The <em>lookup set</em> for <s><code>f</code></s><u><em>N</em></u> in <s><code>C</code></s><u><em>C</em></u>, called <em>S</em>(<em><s>f</s><u>N</u></em>,<em>C</em>), consists of two component sets: the <em>declaration set</em>, a set of members named <s><code>f</code></s><u><em>N</em></u>; and the <em>subobject set</em>, a set of subobjects where declarations of these members<s> (possibly including <em>using-declaration</em>⁠s)</s> were found<u> (possibly via <em>using-declaration</em>⁠s)</u>. In the declaration set, <s><em>using-declaration</em>⁠s are replaced by the set of designated members that are not hidden or overridden by members of the derived class ([namespace.udecl]), and </s>type declarations (including injected-class-names) are replaced by the types they designate. <em>S</em>(<em><s>f</s><u>N</u></em>,<em>C</em>) is calculated as follows:</p>
</blockquote>
<p>Change paragraph 4:</p>
<blockquote>
<p><s>If <code>C</code> contains a declaration of the name <code>f</code>, the declaration set contains every declaration of <code>f</code> declared in <code>C</code> that satisfies the requirements of the language construct in which the lookup occurs.</s> <u>The declaration set is the result of a single search in <em>C</em> for <em>N</em> from immediately after the <em>class-specifier</em> of <em>C</em> if <em>P</em> is in a complete-class context of <em>C</em> or from <em>P</em> otherwise.</u> <s>[<em>Note</em>: […] — <em>end note</em>]</s> […]</p>
</blockquote>
<p>[<em>Drafting note</em>: The plan for CWG2335 is to describe forbidden dependency cycles among the complete-class contexts of a class. — <em>end drafting note</em>]</p>
<p>Change paragraph 5:</p>
<blockquote>
<p>[…] <s>If <code>C</code> has base classes, c</s><u>C</u>alculate the lookup set for <s><code>f</code></s><u><em>N</em></u> in each direct <u>non-dependent ([temp.dep.type]) </u>base class subobject <em>B<sub>i</sub></em>, and merge each such lookup set <em>S</em>(<em><s>f</s><u>N</u></em>,<em>B<sub>i</sub></em>) in turn into <em>S</em>(<em><s>f</s><u>N</u></em>,<em>C</em>). <u>[<em>Note</em>: If <em>C</em> is incomplete, only base classes whose <em>base-specifier</em> appears before <em>P</em> are considered. If <em>C</em> is an instantiated class, its base classes are not dependent. — <em>end note</em>]</u></p>
</blockquote>
<p>Change paragraph 7:</p>
<blockquote>
<p>The result of <s>name lookup for <code>f</code> in <code>C</code></s><u>the search</u> is the declaration set of <em>S</em>(<em><s>f</s><u>N</u></em>,<em>C</em>). If it is an invalid set, the program is ill-formed. <u>If it differs from the result of a search in <em>C</em> for <em>N</em> from immediately after the <em>class-specifier</em> of <em>C</em>, the program is ill-formed, no diagnostic required.</u> [<em>Example</em>:</p>
<p>[…]</p>
<p><em>S</em>(<s><em>x</em></s><u><code>x</code></u>,<s><em>F</em></s><u><code>F</code></u>) is unambiguous because the <code>A</code> and <code>B</code> base class subobjects of <code>D</code> are also base class subobjects of <code>E</code>, so <em>S</em>(<s><em>x</em></s><u><code>x</code></u>,<s><em>D</em></s><u><code>D</code></u>) is discarded in the first merge step. — <em>end example</em>]</p>
</blockquote>
<div class="del">
Replace paragraph 8:
</div>
<div class="ins">
<blockquote>
<p>If <em>N</em> is a non-dependent <em>conversion-function-id</em>, conversion function templates that are members of <em>C</em> are considered. For each such template <em>T</em>, the lookup set <em>S</em>(<em>t</em>,<em>C</em>) is constructed, considering a function template declaration to have the name <em>t</em> only if it corresponds to a declaration of <em>T</em> ([basic.scope.scope]). The members of the declaration set of each such lookup set, which shall not be an invalid set, are included in the result. [<em>Note</em>: Overload resolution will discard those that cannot convert to the type specified by <em>N</em> ([temp.over]). — <em>end note</em>]</p>
</blockquote>
</div>
<h4 id="basic.lookup.unqual">[basic.lookup.unqual]</h4>
<div class="del">
Replace contents (including the existing paragraph 16 at the end):
</div>
<div class="ins">
<blockquote>
<p>A <em>using-directive</em> is active in a scope <em>S</em> at a program point <em>P</em> if it precedes <em>P</em> and inhabits either <em>S</em> or the scope of a namespace nominated by a <em>using-directive</em> that is active in <em>S</em> at <em>P</em>. [<em>Note</em>: A <em>using-directive</em> is exported if and only if it appears in a header unit. — <em>end note</em>]</p>
</blockquote>
<blockquote>
<p>An <em>unqualified search</em> in a scope <em>S</em> from a program point <em>P</em> includes the results of searches from <em>P</em> in</p>
<ol style="list-style-type: decimal">
<li><em>S</em>, and</li>
<li>for any scope <em>U</em> that contains <em>P</em> and is or is contained by <em>S</em>, each namespace contained by <em>S</em> that is nominated by a <em>using-directive</em> that is active in <em>U</em> at <em>P</em>.</li>
</ol>
<p>If no declarations are found, the results of the unqualified search are the results of an unqualified search in the parent scope of <em>S</em>, if any, from <em>P</em>. [<em>Note</em>: When a class scope is searched, the scopes of its base classes are also searched ([class.member.lookup]). If it inherits from a single base, it is as if the scope of the base immediately contains the scope of the derived class. — <em>end note</em>]</p>
</blockquote>
<blockquote>
<p><em>Unqualified name lookup</em> from a program point performs an unqualified search in its immediate scope.</p>
</blockquote>
<blockquote>
<p>An <em>unqualified name</em> is a name that does not follow a <em>nested-name-specifier</em> or the <code>.</code> or <code>-&gt;</code> in a class member access expression ([expr.ref]), possibly after a <code>template</code> keyword or <code>~</code>. Unless otherwise specified, such a name undergoes unqualified name lookup from the point where it appears.</p>
</blockquote>
<blockquote>
<p>An unqualified name that is a component name ([expr.prim.id.unqual]) of a <em>type-specifier</em> or <em>ptr-operator</em> of a <em>conversion-type-id</em> is looked up in the same fashion as the <em>conversion-function-id</em> in which it appears. If that lookup finds nothing, it undergoes unqualified name lookup; in each case, only names that denote types or templates whose specializations are types are considered.<!-- remote --></p>
</blockquote>
<blockquote>
<p>In a friend declaration, lookup for an unqualified name that appears in a <em>declarator</em> after a <em>declarator-id</em> with a <em>nested-name-specifier</em> that names a class, class template, or namespace <em>S</em> performs an unqualified search in <em>S</em>.<!-- non-nested --> If that lookup finds nothing, it undergoes unqualified name lookup.</p>
</blockquote>
<blockquote>
<p>[<em>Note</em>: The rules for name lookup in template definitions are described in [temp.res]. — <em>end note</em>]</p>
</blockquote>
</div>
<h4 id="basic.lookup.argdep">[basic.lookup.argdep]</h4>
<p>Change paragraph 1:</p>
<blockquote>
<p>When the <em>postfix-expression</em> in a function call ([expr.call]) is an <em>unqualified-id</em>, <u>and</u><s>other namespaces not considered during the usual</s> unqualified lookup ([basic.lookup.unqual]) <s>may be searched, and in those namespaces, namespace-scope friend function or function template declarations ([class.friend]) not otherwise visible may be found. These modifications to the search</s><u>for the name in the <em>unqualified-id</em> does not find any</u></p>
<ol style="list-style-type: decimal">
<li><u>declaration of a class member, or</u></li>
<li><u>function declaration inhabiting a block scope, or</u></li>
<li><u>declaration not of a function or function template</u></li>
</ol>
<p><u>then lookup for the name also includes the result of <em>argument-dependent lookup</em> in a set of <em>associated namespaces</em> that</u> depend<u>s</u> on the types of the arguments (and for template template arguments, the namespace of the template argument)<u>, as specified below</u>. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Move the note from [basic.lookup.unqual]/3 here, inserting it before paragraph 2.</p>
<p>Change paragraph 2:</p>
<blockquote>
<p>For each argument type <code>T</code> in the function call, there is <s>a set of zero or more <em>associated namespaces</em> and </s>a set of zero or more <em>associated entities</em><s> (other than namespaces)</s> to be considered. The set<s>s</s> of <s>namespaces and </s>entities <s>are</s><u>is</u> determined entirely by the types of the function arguments (and <s>the namespace of </s>any template template argument<u>s</u>). Typedef names and <em>using-declaration</em>⁠s used to specify the types do not contribute to this set. The set<s>s</s> of <s>namespaces and </s>entities <s>are</s><u>is</u> determined in the following way:</p>
<ol style="list-style-type: decimal">
<li>If <code>T</code> is a fundamental type, its associated set<s>s</s> of <s>namespaces and </s>entities <s>are both</s><u>is</u> empty.</li>
<li>If <code>T</code> is a class type (including unions), its associated entities are: the class itself; the class of which it is a member, if any; and its direct and indirect base classes. <s>Its associated namespaces are the innermost enclosing namespaces of its associated entities.</s> Furthermore, if <code>T</code> is a class template specialization, its associated <s>namespaces and </s>entities also include: the <s>namespaces and </s>entities associated with the types of the template arguments provided for template type parameters<s> (excluding template template parameters)</s>; the templates used as template template arguments;<s> the namespaces of which any template template arguments are members;</s> and the classes of which any member templates used as template template arguments are members. [<em>Note</em>: Non-type template arguments do not contribute to the set of associated <s>namespaces</s><u>entities</u>. — <em>end note</em>]</li>
<li>If <code>T</code> is an enumeration type, <s>its associated namespace is the innermost enclosing namespace of its declaration, and </s>its associated entities are <code>T</code> and, if it is a class member, the member’s class.</li>
<li>If <code>T</code> is a pointer to <code>U</code> or an array of <code>U</code>, its associated <s>namespaces and </s>entities are those associated with <code>U</code>.</li>
<li>If <code>T</code> is a function type, its associated <s>namespaces and </s>entities are those associated with the function parameter types and those associated with the return type.</li>
<li>If <code>T</code> is a pointer to a member function of a class <code>X</code>, its associated <s>namespaces and </s>entities are those associated with the function parameter types and return type, together with those associated with <code>X</code>.</li>
<li>If <code>T</code> is a pointer to a data member of class <code>X</code>, its associated <s>namespaces and </s>entities are those associated with the member type together with those associated with <code>X</code>.</li>
</ol>
<p><s>If an associated namespace is an inline namespace ([namespace.def]), its enclosing namespace is also included in the set. If an associated namespace directly contains inline namespaces, those inline namespaces are also included in the set.</s> In addition, if the argument is <s>the name or address of </s>an overload set<u> or the address of such a set</u>, its associated entities<s> and namespaces</s> are the union of those associated with each of the members of the set, i.e., the entities<s> and namespaces</s> associated with its parameter types and return type. Additionally, if the aforementioned overload set is named with a <em>template-id</em>, its associated entities<s> and namespaces</s> also include <s>those of its type <em>template-argument</em>⁠s and </s>its template <em>template-argument</em>⁠s<u> and those associated with its type <em>template-argument</em>⁠s</u>.</p>
</blockquote>
<p>Change paragraph 3 and move it to the end of the subclause:</p>
<blockquote>
<p><s>Let <em>X</em> be the lookup set produced by unqualified lookup ([basic.lookup.unqual]) and let <em>Y</em> be the lookup set produced by argument dependent lookup (defined as follows). If <em>X</em> contains</s></p>
<ol style="list-style-type: decimal">
<li><s>a declaration of a class member, or</s></li>
<li><s>a block-scope function declaration that is not a <em>using-declaration</em>, or</s></li>
<li><s>a declaration that is neither a function nor a function template</s></li>
</ol>
<p><s>then <em>Y</em> is empty. Otherwise <em>Y</em> is the set of declarations found in the namespaces associated with the argument types as described below. The set of declarations found by the lookup of the name is the union of <em>X</em> and <em>Y</em>.</s> [<em>Note</em>: The <u>associated </u>namespaces<s> and entities associated with the argument types</s> can include namespaces<s> and entities</s> already considered by <s>the </s>ordinary unqualified lookup. — <em>end note</em>] [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 4:</p>
<blockquote>
<p><s>When considering an</s><u>The associated namespaces for a call are the innermost enclosing non-inline namespaces for its associated entities as well as every element of the inline namespace set of those namespaces. Argument-dependent lookup finds all declarations of functions and function templates that</u></p>
<ol style="list-style-type: decimal">
<li><u>are found by a search of any</u> associated namespace <s><code>N</code></s>, <s>the lookup is the same as the lookup performed when <code>N</code> is used as a qualifier ([namespace.qual]) except that:</s><u>or</u></li>
<li><s>Any <em>using-directive</em>⁠s in <code>N</code> are ignored.</s></li>
<li><s>All names except those of (possibly overloaded) functions and function templates are ignored.</s></li>
<li><s>Any namespace-scope</s><u>are declared as a</u> friend<s> functions or friend function templates</s> ([class.friend]) <s>declared in</s><u>of any</u> class<s>es</s> with <u>a </u>reachable definition<s>s</s> in the set of associated entities<s> are visible within their respective namespaces even if they are not visible during an ordinary lookup ([namespace.memdef]).</s><u>, or</u></li>
<li><s>Any</s><u>are</u> exported <s>declaration <code>D</code> in <code>N</code> declared within the purview of</s><u>, are attached to </u> a named module <code>M</code> ([module.interface])<s> is visible if there is</s><u>, do not appear in the translation unit containing the point of the lookup, and have the same innermost enclosing non-inline namespace scope as a declaration of</u> an associated entity attached to <code>M</code><s> with the same innermost enclosing non-inline namespace as <code>D</code></s>.</li>
</ol>
<p><s>5.</s> If the lookup is for a dependent name ([temp.dep], [temp.dep.candidate]), <s>any declaration <code>D</code> in <code>N</code> is visible if <code>D</code> would be visible to qualified name lookup ([namespace.qual]) at any</s><u>the above lookup is also performed from each</u> point in the instantiation context ([module.context]) of the lookup, <s>unless <code>D</code> is declared</s><u>additionally ignoring any declaration that appears</u> in another translation unit, <u>is </u>attached to the global module, and is either discarded ([module.global.frag]) or has internal linkage.</p>
</blockquote>
<h4 id="basic.lookup.qual">[basic.lookup.qual]</h4>
<p>Change paragraph 1:</p>
<blockquote>
<p><s>The name of a class or namespace member or enumerator can be referred to after the <code>::</code> scope resolution operator ([expr.prim.id.qual]) applied to a <em>nested-name-specifier</em> that denotes its class, namespace, or enumeration.</s> <s>If</s><u>Lookup of an <em>identifier</em> followed by</u> a <code>::</code> scope resolution operator<s> in a <em>nested-name-specifier</em> is not preceded by a <em>decltype-specifier</em>, lookup of the name preceding that <code>::</code></s> considers only namespaces, types, and templates whose specializations are types.<!-- remote --> If <s>the name found does not</s><u>a name, <em>template-id</em>, or <em>decltype-specifier</em> is followed by a <code>::</code>, it shall</u> designate a namespace<s> or a</s><u>,</u> class, enumeration, or dependent type, <s>the program is ill-formed</s><u>and the <code>::</code> is never interpreted as a complete <em>nested-name-specifier</em></u>. [<em>Example</em>:</p>
<pre class="cpp">
class A {
public:
  static int n;
};
int main() {
  int A;
  A::n = 42;        // OK
  A b;              // error: A does not name a type
}<u>
template<int> struct B : A {};
namespace N {
  template<int> void B();
  int f() {return B<0>::n;}  // error: N::B<0> is not a type
}</u>
</pre>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Insert before paragraph 2:</p>
<div class="ins">
<blockquote>
<p>A <em>member-qualified name</em> is the (unique) component name ([expr.prim.id.unqual]), if any, of</p>
<ol style="list-style-type: decimal">
<li>an <em>unqualified-id</em>, or</li>
<li>a <em>nested-name-specifier</em> of the form <em>type-name</em> <code>::</code> or <em>namespace-name</em> <code>::</code>,</li>
</ol>
<p>in the <em>id-expression</em> of a class member access expression ([expr.ref]). A <em>qualified name</em> is a member-qualified name or the terminal name of a <em>qualified-id</em>, a <em>using-declarator</em>, a <em>typename-specifier</em>, a <em>qualified-namespace-specifier</em>, or a <em>nested-name-specifier</em>, <em>elaborated-type-specifier</em>, or <em>class-or-decltype</em> that has a <em>nested-name-specifier</em> ([expr.prim.id.qual]). The <em>lookup context</em> of a member-qualified name is the type of its associated object expression (considered dependent if the object expression is type-dependent). The lookup context of any other qualified name is the type, template, or namespace nominated by the preceding <em>nested-name-specifier</em>. [<em>Note</em>: When parsing a class member access, the name following the <code>-&gt;</code> or <code>.</code> is a qualified name even though it is not yet known of which kind. — <em>end note</em>] [<em>Example</em>: In</p>
<pre class="sourceCode cpp"><code class="sourceCode cpp">N::C::m.Base::f()</code></pre>
<p><code>Base</code> is a member-qualified name; the other qualified names are <code>C</code>, <code>m</code>, and <code>f</code>. — <em>end example</em>]</p>
</blockquote>
<blockquote>
<p><em>Qualified name lookup</em> in a class, namespace, or enumeration performs a search of the scope associated with it ([class.member.lookup]) except as specified below. Unless otherwise specified, a qualified name undergoes qualified name lookup in its lookup context from the point where it appears unless the lookup context either is dependent and is not the current instantiation ([temp.dep.type]) or is not a class or class template. If nothing is found by qualified lookup for a member-qualified name that is the terminal name of a <em>nested-name-specifier</em> and is not dependent, it undergoes unqualified lookup. [<em>Note</em>: During lookup for a template specialization, no names are dependent. — <em>end note</em>] [<em>Example</em>:</p>
<pre class="sourceCode cpp"><code class="sourceCode cpp"><span class="dt">int</span> f();
<span class="kw">struct</span> A {
  <span class="dt">int</span> B,C;
  <span class="kw">template</span>&lt;<span class="dt">int</span>&gt; <span class="kw">using</span> D=<span class="dt">void</span>;
  <span class="kw">using</span> T=<span class="dt">void</span>;
  <span class="dt">void</span> f();
};
<span class="kw">using</span> B=A;
<span class="kw">template</span>&lt;<span class="dt">int</span>&gt; <span class="kw">using</span> C=A;
<span class="kw">template</span>&lt;<span class="dt">int</span>&gt; <span class="kw">using</span> D=A;
<span class="kw">template</span>&lt;<span class="dt">int</span>&gt; <span class="kw">using</span> X=A;

<span class="kw">template</span>&lt;<span class="kw">class</span> T&gt;
<span class="dt">void</span> g(T *p) {            <span class="co">// as instantiated for g&lt;A&gt;:</span>
  p-&gt;X&lt;<span class="dv">0</span>&gt;::f();           <span class="co">// error: A::X not found in ((p-&gt;X) &lt; 0) &gt; ::f()</span>
  p-&gt;<span class="kw">template</span> X&lt;<span class="dv">0</span>&gt;::f();  <span class="co">// OK: ::X found in definition context</span>
  p-&gt;B::f();              <span class="co">// OK: non-type A::B ignored</span>
  p-&gt;<span class="kw">template</span> C&lt;<span class="dv">0</span>&gt;::f();  <span class="co">// error: A::C is not a template</span>
  p-&gt;<span class="kw">template</span> D&lt;<span class="dv">0</span>&gt;::f();  <span class="co">// error: A::D&lt;0&gt; is not a class type</span>
  p-&gt;T::f();              <span class="co">// error: A::T is not a class type</span>
}
<span class="kw">template</span> <span class="dt">void</span> g(A*);</code></pre>
<p>— <em>end example</em>]</p>
</blockquote>
</div>
<div class="del">
Remove paragraphs 3 through 5.
</div>
<p>Change paragraph 6:</p>
<blockquote>
<p><s>In a <em>qualified-id</em> of the form:</s></p>
<blockquote>
<p><s><em>nested-name-specifier</em><sub><em>opt</em></sub> <em>type-name</em> <code>::</code> <code>~</code> <em>type-name</em></s></p>
</blockquote>
<p><s>the second <em>type-name</em> is looked up in the same scope as the first.</s> <u>If the qualified name follows a <code>~</code>:</u></p>
<ol style="list-style-type: decimal">
<li><u>If the qualified name is not a member-qualified name:</u>
<ol style="list-style-type: decimal">
<li><u>Its <em>nested-name-specifier</em> shall nominate a type.</u></li>
<li><u>If the terminal name of the <em>nested-name-specifier</em> is a qualified name, the <em>identifier</em> is looked up in the same fashion as that name.</u></li>
</ol>
<u>[<em>Note</em>: Otherwise, the qualified name is looked up normally. — <em>end note</em>]</u></li>
<li><u>If lookup for the <em>identifier</em> finds nothing or finds it to be a <em>type-name</em> that does not refer to the lookup context (ignoring <em>cv</em>-qualification), it instead undergoes unqualified lookup.</u></li>
<li><u>Each lookup for the <em>identifier</em> considers only types (if the <em>identifier</em> is not followed by a <code>&lt;</code>) and templates whose specializations are types.</u></li>
<li><u>The <em>type-name</em> that is or contains the <em>identifier</em> shall ultimately refer to the lookup context (ignoring <em>cv</em>-qualification).</u></li>
</ol>
[<em>Example</em>:
<pre class="cpp">
struct C {
  typedef int I;<u>
  typedef float I2;</u>
};
typedef int I1, I2;
extern int* p;
extern int* q;
<u>void f() {
  </u>p->C::I::~I<u>2</u>();   <s>   </s>// <u>after finding C::</u>I<u>2</u><s> is</s><u>, unqualified</u> look<s>ed </s>up <s>in the scope of C</s><u>finds ::I2</u>
<u>  </u>q->I1::~I2();     <s>  </s>// I2 <s>is</s><u>undergoes unqualified</u> look<s>ed </s>up<s> in the scope of the postfix-expression</s><u>
}</u>

struct A {
  ~A();
};
typedef A AB;
int main() {
  AB* p;
  p->AB::~AB();     // explicitly calls the destructor for A
}
</pre>
<p>— <em>end example</em>] <s>[<em>Note</em>: [basic.lookup.classref] describes how name lookup proceeds after the <code>.</code> and <code>-&gt;</code> operators. — <em>end note</em>]</s></p>
</blockquote>
<h5 id="class.qual">[class.qual]</h5>
<div class="del">
Remove paragraph 1.
</div>
<p>Change paragraph 2:</p>
<blockquote>
<p>In a lookup <u>for a qualified name whose lookup context is a class <code>C</code> </u>in which function names are not ignored<sup>[…]</sup><s> and the <em>nested-name-specifier</em> nominates a class <code>C</code></s>:</p>
<ol style="list-style-type: decimal">
<li>if the <s>name specified after the <em>nested-name-specifier</em>, when looked up in <code>C</code>, is</s><u>search finds</u> the injected-class-name of <code>C</code> ([class.pre]), or</li>
<li><s>in</s><u>if the qualified name is dependent and is the terminal name of</u> a <em>using-declarator</em><s> of a <em>using-declaration</em></s> ([namespace.udecl]) that <s>is a <em>member-declaration</em>, if the name specified after the <em>nested-name-specifier</em> is the same as the <em>identifier</em> or the <em>simple-template-id</em>’s <em>template-name</em> in the last component of the <em>nested-name-specifier</em></s><u>names a constructor</u>,</li>
</ol>
<p>the name is instead considered to name the constructor of class <code>C</code>. <s>[<em>Note</em>: For example, the constructor is not an acceptable lookup result in an <em>elaborated-type-specifier</em> so the constructor would not be used in place of the injected-class-name. — <em>end note</em>]</s> Such a constructor name shall be used only in the <em>declarator-id</em> of a <u>(friend) </u>declaration <s>that names</s><u>of</u> a constructor or in a <em>using-declaration</em>. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<div class="del">
Remove paragraph 3.
</div>
<h5 id="namespace.qual">[namespace.qual]</h5>
<div class="del">
<p>Remove paragraphs 1 and 2.</p>
Replace paragraph 3, retaining its example:
</div>
<div class="ins">
<blockquote>
<p>Qualified name lookup in a namespace <em>N</em> additionally searches every element of the inline namespace set of <em>N</em> ([namespace.def]). If nothing is found, the results of the lookup are the results of qualified name lookup in each namespace nominated by a <em>using-directive</em> that precedes the point of the lookup and inhabits <em>N</em> or an element of its inline namespace set. [<em>Note</em>: If a <em>using-directive</em> refers to a namespace that has already been considered, it does not affect the result. — <em>end note</em>] [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
</div>
<p>Change paragraph 6:</p>
<blockquote>
<p><s>During the lookup of a qualified namespace member name, if the lookup finds more than one declaration of the member, and if one declaration introduces a c</s><u>[<em>Note</em>: C</u>lass <s>name or</s><u>and</u> enumeration <s>name and the</s><u>declarations are not discarded because of</u> other declarations <s>introduce either the same variable, the same enumerator, or a set of functions, the non-type name hides the class or enumeration name if and only if the declarations are from the same namespace; otherwise (the declarations are from different namespaces), the program is ill-formed</s><u>found in other searches</u>.<u> — <em>end note</em>]</u> [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<div class="del">
Remove paragraph 7.
</div>
<h4 id="basic.lookup.elab">[basic.lookup.elab]</h4>
<div class="del">
Remove paragraphs 1 and 2.
</div>
<p>Insert before paragraph 3:</p>
<div class="ins">
<blockquote>
<p>If the <em>class-key</em> or <code>enum</code> keyword in an <em>elaborated-type-specifier</em> is followed by an <em>identifier</em> that is not followed by <code>::</code>, lookup for the <em>identifier</em> is type-only. [<em>Note</em>: In general, the recognition of an <em>elaborated-type-specifier</em> depends on the following tokens. If the <em>identifier</em> is followed by <code>::</code>, see [basic.lookup.qual]. — <em>end note</em>]</p>
</blockquote>
</div>
<p>Change paragraph 3:</p>
<blockquote>
<p>If the <u>terminal name of the </u><em>elaborated-type-specifier</em> <s>has</s><u>is</u> a<s> <em>nested-name-specifier</em>,</s> qualified name<s> lookup is performed, as described in [basic.lookup.qual], but ignoring any non-type names that have been declared</s><u>, lookup for it is type-only</u>. If the name lookup does not find a previously declared <em>type-name</em>, the <em>elaborated-type-specifier</em> is ill-formed.</p>
</blockquote>
<div class="del">
<h4>[basic.lookup.classref]</h4>
</div>
<p>Remove subclause, referring the stable name to [basic.lookup.qual].</p>
<h3 id="basic.link">[basic.link]</h3>
<p>Change paragraph 3:</p>
<blockquote>
<p><s>A</s><u>The</u> name <s>having</s><u>of an entity that belongs to a</u> namespace scope ([basic.scope.namespace]) has internal linkage if it is the name of</p>
<p>[…]</p>
</blockquote>
<p>Change paragraph 5:</p>
<blockquote>
<p>In addition, a member function, static data member, a named class or enumeration <s>of</s><u>that inhabits a</u> class scope, or an unnamed class or enumeration defined in a <s>class-scope </s>typedef declaration<u> that inhabits a class scope</u> such that the class or enumeration has the typedef name for linkage purposes ([dcl.typedef]), has the same linkage, if any, as the name of the class of which it is a member.</p>
</blockquote>
<p>Change paragraph 6:</p>
<blockquote>
<s>The name of a function declared in block scope and the name of a variable declared by a block scope <code>extern</code> declaration have linkage. If such a declaration is attached to a named module, the program is ill-formed. If there is a visible declaration of an entity with linkage, ignoring entities declared outside the innermost enclosing namespace scope, such that the block scope declaration would be a (possibly ill-formed) redeclaration if the two declarations appeared in the same declarative region, the block scope declaration declares that same entity and receives the linkage of the previous declaration. If there is more than one such matching entity, the program is ill-formed. Otherwise, if no matching entity is found, the block scope entity receives external linkage. If, within a translation unit, the same entity is declared with both internal and external linkage, the program is ill-formed.</s> [<em>Example</em>:
<pre class="cpp">
static void f();
extern "C" void h();
static int i = 0;               // #1
void <s>g</s><u>q</u>() {
  extern void f();              // internal linkage<u>
  extern void g();              // ::g, external linkage</u>
  extern void h();              // C language linkage
  int i;                        // #2: i has no linkage
  {
    extern void f();            // internal linkage
    extern int i;               // #3: <s>ex</s><u>in</u>ternal linkage<s>, ill-formed</s>
  }
}
</pre>

<p><s>Without</s><u>Even though</u> the declaration at line #2<u> hides the declaration at line #1</u>, the declaration at line #3 <s>would link with the</s><u>still</u> <u>re</u>declar<s>ation</s><u>es</u> <s>at line </s>#1<s>. Because the declaration with</s><u> and receives</u> internal linkage<s> is hidden, however, #3 is given external linkage, making the program ill-formed</s>. — <em>end example</em>]</p>
</blockquote>
<div class="del">
<p>Remove paragraph 7 (whose example is moved to [dcl.meaning]).</p>
</div>
<div class="del">
Replace paragraph 9:
</div>
<div class="ins">
<blockquote>
<p>Two declarations of entities declare the same entity if, considering declarations of unnamed types to introduce their names for linkage purposes, if any ([dcl.typedef], [dcl.enum]), they correspond ([basic.scope.scope]), have the same target scope that is not a function or template parameter scope, and either</p>
<ol style="list-style-type: decimal">
<li>they appear in the same translation unit, or</li>
<li>they both declare names with module linkage and are attached to the same module, or</li>
<li>they both declare names with external linkage.</li>
</ol>
<p>[<em>Note</em>: There are other circumstances in which declarations declare the same entity ([dcl.link], [temp.type], [temp.class.spec]). — <em>end note</em>]</p>
</blockquote>
</div>
<p>Change paragraph 10:</p>
<blockquote>
<p>If <s>a declaration would redeclare a reachable</s><u>two</u> declaration<u>s of an entity are</u> attached to <s>a </s>different module<u>s</u>, the program is ill-formed<u>; no diagnostic is required if neither is reachable from the other</u>. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>] As a consequence of these rules, all declarations of an entity are attached to the same module; the entity is said to be <em>attached</em> to that module.</p>
</blockquote>
<p>Change paragraph 11:</p>
<blockquote>
<p><u>For any two declarations of an entity:</u></p>
<ol style="list-style-type: decimal">
<li><u>If one declares it to be a variable or function, the other shall declare it as one of the same type.</u></li>
<li><u>If one declares it to be an enumerator, the other shall do so.</u></li>
<li><u>If one declares it to be a namespace, the other shall do so.<!-- TODO: with the same inline status? --></u></li>
<li><u>If one declares it to be a type, the other shall declare it to be a type of the same kind ([dcl.type.elab]).</u></li>
<li><u>If one declares it to be a class template, the other shall do so with the same kind and an equivalent <em>template-head</em> ([temp.over.link]). [<em>Note</em>: The declarations may supply different default template arguments. — <em>end note</em>]</u></li>
<li><u>If one declares it to be a function template or a (partial specialization of a) variable template, the other shall declare it to be one with an equivalent <em>template-head</em> and type.</u></li>
<li><u>If one declares it to be an alias template, the other shall declare it to be one with an equivalent <em>template-head</em> and <em>defining-type-id</em>.</u></li>
<li><u>If one declares it to be a concept, the other shall do so.</u></li>
</ol>
<p><u>Types are compared a</u><s>A</s>fter all adjustments of types (during which typedefs ([dcl.typedef]) are replaced by their definitions)<s>, the types specified by all declarations referring to a given variable or function shall be identical, except that</s><u>;</u> declarations for an array object can specify array types that differ by the presence or absence of a major array bound ([dcl.array]). <s>A violation of this rule on type identity does not require a</s><u>No</u> diagnostic<u> is required if neither declaration is reachable from the other</u>. <u>[<em>Example</em>:</u></p>
<pre class="sourceCode cpp ins"><code class="sourceCode cpp"><span class="dt">int</span> f(<span class="dt">int</span> x,<span class="dt">int</span> x);  <span class="co">// error: different entities for x</span>
<span class="dt">void</span> g();            <span class="co">// #1</span>
<span class="dt">void</span> g(<span class="dt">int</span>);         <span class="co">// OK: different entity from #1</span>
<span class="dt">int</span> g();             <span class="co">// error: same entity as #1 with different type</span>
<span class="dt">void</span> h();            <span class="co">// #2</span>
<span class="kw">namespace</span> h {}       <span class="co">// error: same entity as #2, but not a function</span></code></pre>
<p><u>— <em>end example</em>]</u></p>
</blockquote>
<h3 id="basic.life">[basic.life]</h3>
<p>Change the footnote in paragraph 6:</p>
<blockquote>
<p>For example, before the <s>construction of a global object that is initialized via a user-provided constructor</s><u>dynamic initialization of an object with static storage duration</u> ([<s>class.cdtor</s><u>basic.start.dynamic</u>]).</p>
</blockquote>
<h3 id="basic.stc">[basic.stc]</h3>
<h4 id="basic.stc.static">[basic.stc.static]</h4>
<p>Change paragraph 3:</p>
<blockquote>
<p>The keyword <code>static</code> can be used to declare a <s>local</s><u>block</u> variable with static storage duration. [<em>Note</em>: [stmt.dcl]<u> and [basic.start.term]</u> describe<s>s</s> the initialization <s>of local <code>static</code> variables; [basic.start.term] describes the</s><u>and</u> destruction of <s>local <code>static</code></s><u>such</u> variables. — <em>end note</em>]</p>
</blockquote>
<h4 id="basic.stc.auto">[basic.stc.auto]</h4>
<p>Change paragraph 1:</p>
<blockquote>
<p><s>Block-scope v</s><u>V</u>ariables<u> that belong to a block or parameter scope and are</u> not explicitly declared <code>static</code>, <code>thread_local</code>, or <code>extern</code> have <em>automatic storage duration</em>. The storage for these entities lasts until the block in which they are created exits.</p>
</blockquote>
<h3 id="basic.type.qualifier">[basic.type.qualifier]</h3>
<p>Change paragraph 4:</p>
<blockquote>
<p>[<em>Note</em>: See [dcl.fct] and [<s>class.this</s><u>over.match.funcs</u>] regarding function types that have <em>cv-qualifier</em>⁠s. — <em>end note</em>]</p>
</blockquote>
<h3 id="basic.start">[basic.start]</h3>
<h4 id="basic.start.main">[basic.start.main]</h4>
<p>Change paragraph 3:</p>
<blockquote>
<p>The function <code>main</code> shall not be used within a program. The linkage ([basic.link]) of <code>main</code> is implementation-defined. A program that defines <code>main</code> as deleted or that declares <code>main</code> to be <code>inline</code>, <code>static</code>, or <code>constexpr</code> is ill-formed. The function <code>main</code> shall not be a coroutine ([dcl.fct.def.coroutine]). The <code>main</code> function shall not be declared with a <em>linkage-specification</em> ([dcl.link]). A program that declares a variable <code>main</code> <s>at</s><u>that belongs to the</u> global scope, or that declares a function <code>main</code> <s>at</s><u>that belongs to the</u> global scope <u>and is </u>attached to a named module, or that declares <s>the</s><u>an entity</u> name<u>d</u> <code>main</code> with C language linkage (in any namespace) is ill-formed. The name <code>main</code> is not otherwise reserved. [<em>Example</em>: Member functions, classes, and enumerations can be called <code>main</code>, as can entities in other namespaces. — <em>end example</em>]</p>
</blockquote>
<h4 id="basic.start.static">[basic.start.static]</h4>
<p>Change paragraph 2:</p>
<blockquote>
<p>[…][<em>Note</em>: The dynamic initialization of non-<s>local</s><u>block</u> variables is described in [basic.start.dynamic]; that of <s>local </s>static <u>block </u>variables is described in [stmt.dcl]. — <em>end note</em>]</p>
</blockquote>
<h4 id="dynamic-initialization-of-non-localblock-variables-basic.start.dynamic">Dynamic initialization of non-<s>local</s><u>block</u> variables [basic.start.dynamic]</h4>
<p>Replace all occurrences of “non-local variable” with “non-block variable” (including in the name of the subclause).</p>
<h4 id="basic.start.term">[basic.start.term]</h4>
<p>Change paragraph 3:</p>
<blockquote>
<p>[…] If an object is initialized statically, the object is destroyed in the same order as if the object was dynamically initialized. For an object of array or class type, all subobjects of that object are destroyed before any block<s>-scope object</s><u> variable</u> with static storage duration initialized during the construction of the subobjects is destroyed. If the destruction of an object with static or thread storage duration exits via an exception, the function <code>std::terminate</code> is called ([except.terminate]).</p>
</blockquote>
<p>Change paragraph 4:</p>
<blockquote>
<p>If a function contains a block<s>-scope object</s><u> variable</u> of static or thread storage duration that has been destroyed and the function is called during the destruction of an object with static or thread storage duration, the program has undefined behavior if the flow of control passes through the definition of the previously destroyed block<s>-scope object</s><u> variable</u>. <u>[<em>Note</em>: </u>Likewise, the behavior is undefined if the block<s>-scope object</s><u> variable</u> is used indirectly (<s>i.e.</s><u><em>e.g.</em></u>, through a pointer) after its destruction.<u> — <em>end note</em>]</u></p>
</blockquote>
<h2 id="expr">[expr]</h2>
<h3 id="expr.prim">[expr.prim]</h3>
<h4 id="expr.prim.this">[expr.prim.this]</h4>
<p>Change paragraph 1:</p>
<blockquote>
<p>The keyword <code>this</code> names a pointer to the object for which a non-static member function ([class.<s>this</s><u>mfct.non-static</u>]) is invoked or a non-static data member’s initializer ([class.mem]) is evaluated.</p>
</blockquote>
<p>Insert before paragraph 2:</p>
<div class="ins">
<blockquote>
<p>The <em>current class</em> at a program point is the class associated with the innermost class scope containing that point. [<em>Note</em>: A <em>lambda-expression</em> does not introduce a class scope. — <em>end note</em>]</p>
</blockquote>
</div>
<p>Change paragraph 2:</p>
<blockquote>
<p>If a declaration declares a member function or member function template of a class <code>X</code>, the expression <code>this</code> is a prvalue of type “pointer to <em>cv-qualifier-seq</em> <code>X</code>”<u> wherever <code>X</code> is the current class</u> between the optional <em>cv-qualifier-seq</em> and the end of the <em>function-definition</em>, <em>member-declarator</em>, or <em>declarator</em>. It shall not appear before the optional <em>cv-qualifier-seq</em> and it shall not appear within the declaration of a static member function<u> of the current class</u> (although its type and value category are defined within a static member function as they are within a non-static member function). [<em>Note</em>: This is because declaration matching does not occur until the complete declarator is known. — <em>end note</em>] [<em>Note</em>: In a <em>trailing-return-type</em>, the class being defined is not required to be complete for purposes of class member access ([expr.ref]). Class members declared later are not visible. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>] — <em>end note</em>]</p>
</blockquote>
<p>Change paragraph 3:</p>
<blockquote>
<p>Otherwise, if a <em>member-declarator</em> declares a non-static data member ([class.mem]) of a class <code>X</code>, the expression <code>this</code> is a prvalue of type “pointer to <code>X</code>”<u> wherever <code>X</code> is the current class</u> within the optional default member initializer ([class.mem]). <s>It shall not appear elsewhere in the <em>member-declarator</em>.</s></p>
</blockquote>
<h4 id="expr.prim.id">[expr.prim.id]</h4>
<p>Insert before paragraph 2:</p>
<div class="ins">
<blockquote>
<p>If an <em>id-expression</em> <em>E</em> denotes a member <em>M</em> of an anonymous union ([class.union.anon]) <em>U</em>:</p>
<ol style="list-style-type: decimal">
<li>If <em>U</em> is a non-static data member, <em>E</em> refers to <em>M</em> as a member of the lookup context of the terminal name of <em>E</em> (after any transformation to a class member access expression ([class.mfct.non-static])). [<em>Example</em>: <code>o.x</code> is interpreted as <code>o.<em>u</em>.x</code>, where <em><code>u</code></em> names the anonymous union member. — <em>end example</em>]</li>
<li>Otherwise, <em>E</em> is interpreted as a class member access ([expr.ref]) that designates the member subobject <em>M</em> of the anonymous union variable for <em>U</em>. [<em>Note</em>: Under this interpretation, <em>E</em> no longer denotes a non-static data member. — <em>end note</em>][<em>Example</em>: <code>N::x</code> is interpreted as <code>N::<em>u</em>.x</code>, where <em><code>u</code></em> names the anonymous union variable. — <em>end example</em>]</li>
</ol>
</blockquote>
</div>
<h5 id="expr.prim.id.unqual">[expr.prim.id.unqual]</h5>
<p>Insert before paragraph 2:</p>
<div class="ins">
<blockquote>
<p>A <em>component name</em> of an <em>unqualified-id</em> <em>U</em> is <em>U</em> if it is a name or the component name of the <em>template-id</em> or <em>type-name</em> of <em>U</em>, if any. [<em>Note</em>: Other constructs that contain names to look up can have several component names ([expr.prim.id.qual], [dcl.type.simple], [dcl.type.elab], [dcl.mptr], [namespace.udecl], [temp.param], [temp.names], [temp.res]). — _end note_] The <em>terminal name</em> of a construct is the component name of that construct that appears lexically last.</p>
</blockquote>
</div>
<p>Change paragraph 2:</p>
<blockquote>
<p>The result is the entity denoted by the <s>identifier</s><u><em>unqualified-id</em> ([basic.lookup.unqual])</u>. If the entity is a local entity […]</p>
</blockquote>
<h5 id="expr.prim.id.qual">[expr.prim.id.qual]</h5>
<p>Insert before paragraph 1:</p>
<div class="ins">
<blockquote>
<p>The component names of a <em>qualified-id</em> are those of its <em>nested-name-specifier</em> and <em>unqualified-id</em>. The component names of a <em>nested-name-specifier</em> are its <em>identifier</em> (if any) and those of its <em>type-name</em>, <em>namespace-name</em>, <em>simple-template-id</em>, and/or <em>nested-name-specifier</em>.</p>
</blockquote>
<blockquote>
<p>A <em>nested-name-specifier</em> is <em>declarative</em> if it is part of</p>
<ol style="list-style-type: decimal">
<li>a <em>class-head-name</em>,</li>
<li>an <em>enum-head-name</em>,</li>
<li>a <em>qualified-id</em> that is the <em>id-expression</em> of a <em>declarator-id</em>, or</li>
<li>a declarative <em>nested-name-specifier</em>.</li>
</ol>
<p>A declarative <em>nested-name-specifier</em> shall not have a <em>decltype-specifier</em>. A declaration that uses a declarative <em>nested-name-specifier</em> shall be a friend declaration or inhabit a scope that contains the entity being redeclared or specialized.</p>
</blockquote>
</div>
<p>Change paragraph 1:</p>
<blockquote>
<p><u>The <em>nested-name-specifier</em> <code>::</code> nominates the global namespace.</u> <s>The type denoted by</s><u>A <em>nested-name-specifier</em> with</u> a <em>decltype-specifier</em> <s>in a <em>nested-name-specifier</em></s><u>nominates the type denoted by the <em>decltype-specifier</em>, which</u> shall be a class or enumeration type. <u>If a <em>nested-name-specifier</em> <em>N</em> is declarative and has a <em>simple-template-id</em> with a template argument list <em>A</em> that involves a template parameter, let <em>T</em> be the template nominated by <em>N</em> without <em>A</em>. <em>T</em> shall be a class template.</u></p>
<ol style="list-style-type: decimal">
<li><u>If <em>A</em> is the template argument list ([temp.arg]) of the corresponding <em>template-head</em> <em>H</em> ([temp.mem]), <em>N</em> nominates the primary template of <em>T</em>; <em>H</em> shall be equivalent to the <em>template-head</em> of <em>T</em> ([temp.over.link]).</u></li>
<li><u>Otherwise, <em>N</em> nominates the partial specialization ([temp.class.spec]) of <em>T</em> whose template argument list is equivalent to <em>A</em> ([temp.over.link]); the program is ill-formed if no such partial specialization exists.</u></li>
</ol>
<p><u>Any other <em>nested-name-specifier</em> nominates the entity denoted by its <em>type-name</em>, <em>namespace-name</em>, <em>identifier</em>, or <em>simple-template-id</em>. If the <em>nested-name-specifier</em> is not declarative, the entity shall not be a template.</u></p>
</blockquote>
<p>Insert before paragraph 2:</p>
<div class="ins">
<blockquote>
<p>A <em>qualified-id</em> shall not be of the form <em>nested-name-specifier</em> <code>template</code><sub><em>opt</em></sub> <code>~</code> <em>decltype-specifier</em> nor of the form <em>decltype-specifier</em> <code>::</code> <code>~</code> <em>type-name</em>.</p>
</blockquote>
</div>
<p>Change paragraph 2:</p>
<blockquote>
<p><s>A <em>nested-name-specifier</em> that denotes a class, optionally followed by the keyword <code>template</code> ([temp.names]), and then followed by the name of a member of either that class ([class.mem]) or one of its base classes ([class.derived]), is a <em>qualified-id</em>; [class.qual] describes name lookup for class members that appear in <em>qualified-id</em>⁠s.</s> The result<u> of a <em>qualified-id</em></u> is the <s>member</s><u>entity it denotes ([basic.lookup.qual])</u>. The type of the <s>result</s><u>expression</u> is the type of the <s>member</s><u>result</u>. The result is an lvalue if the member is<u> a function, a variable, a structured binding ([dcl.struct.bind]),</u> a static member function<u>,</u> or a data member and a prvalue otherwise. <s>[<em>Note</em>: A class member can be referred to using a <em>qualified-id</em> at any point in its potential scope ([basic.scope.class]). — <em>end note</em>] Where <em>type-name</em> <code>::~</code> <em>type-name</em> is used, the two <em>type-name</em>⁠s shall refer to the same type (ignoring cv-qualifications); this notation denotes the destructor of the type so named ([expr.prim.id.dtor]). The <em>unqualified-id</em> in a <em>qualified-id</em> shall not be of the form <code>~</code><em>decltype-specifier</em>.</s></p>
</blockquote>
<div class="del">
Remove paragraphs 3 through 5.
</div>
<h4 id="expr.prim.lambda">[expr.prim.lambda]</h4>
<h5 id="expr.prim.lambda.closure">[expr.prim.lambda.closure]</h5>
<p>Change paragraph 4:</p>
<blockquote>
<p>[…] <s>[<em>Note</em>: Names referenced in the <em>lambda-declarator</em> are looked up in the context in which the <em>lambda-expression</em> appears. — <em>end note</em>]</s> [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 12:</p>
<blockquote>
<p>The <em>lambda-expression</em>’s <em>compound-statement</em> yields the <em>function-body</em> ([dcl.fct.def]) of the function call operator, but <s>for purposes of name lookup ([basic.lookup]), determining the type and value of <code>this</code> ([class.this]) and transforming <em>id-expression</em>⁠s referring to non-static class members into class member access expressions using <code>(*this)</code> ([class.mfct.non-static]), the <em>compound-statement</em> is considered in the context of the <em>lambda-expression</em></s><u>it is not within the scope of the closure type</u>.<!-- remote --> [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>] Further, a variable <code>__func__</code> is implicitly defined at the beginning of the <em>compound-statement</em> of the <em>lambda-expression</em>, with semantics as described in [dcl.fct.def.general].</p>
</blockquote>
<h5 id="expr.prim.lambda.capture">[expr.prim.lambda.capture]</h5>
<p>Change paragraph 6:</p>
<blockquote>
<p>An <em>init-capture</em> without ellipsis behaves as if it declares<s> and explicitly captures</s> a variable of the form “<code>auto</code> <em>init-capture</em> <code>;</code>” <s>whose declarative region is</s><u>in</u> the <em>lambda-expression</em>’s <em>compound-statement</em><u> and captures it</u>, except that:</p>
<p>[…]</p>
</blockquote>
<p>Change paragraph 17:</p>
<blockquote>
<p>A <em>simple-capture</em> containing an ellipsis is a pack expansion ([temp.variadic]). An <em>init-capture</em> containing an ellipsis is a pack expansion that <s>introduces</s><u>declares</u> an <em>init-capture</em> pack ([temp.variadic]) <s>whose declarative region is</s><u>in</u> the <em>lambda-expression</em>’s <em>compound-statement</em>. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<h4 id="expr.prim.req">[expr.prim.req]</h4>
<p>Change the grammar in paragraph 1:</p>
<blockquote>
<p>[…]</p>
<p><em>requirement-parameter-list</em>:</p>
<blockquote>
<p><code>(</code> <em>parameter-declaration-clause</em><sub><s><em>opt</em></s></sub> <code>)</code></p>
</blockquote>
<p>[…]</p>
</blockquote>
<p>Change paragraph 4:</p>
<blockquote>
<p>A <em>requires-expression</em> may introduce local parameters using a <em>parameter-declaration-clause</em> ([dcl.fct]). A local parameter of a <em>requires-expression</em> shall not have a default argument. <s>Each name introduced by a local parameter is in scope from the point of its declaration until the closing brace of the <em>requirement-body</em>.</s> These parameters have no linkage, storage, or lifetime; they are only used as notation for the purpose of defining <em>requirement</em>s. […]</p>
</blockquote>
<div class="del">
Remove paragraph 5.
</div>
<h3 id="expr.post">[expr.post]</h3>
<h4 id="expr.call">[expr.call]</h4>
<p>Change paragraph 7:</p>
<blockquote>
<p>[…] If the function is a non-static member function, the <code>this</code> parameter of the function ([<s>class</s><u>expr.prim</u>.this]) is initialized with a pointer to the object of the call, converted as if by an explicit type conversion ([expr.cast]). […]</p>
</blockquote>
<h4 id="expr.ref">[expr.ref]</h4>
<p>Change paragraph 1:</p>
<blockquote>
<p>A postfix expression followed by a dot <code>.</code> or an arrow <code>-&gt;</code>, optionally followed by the keyword <code>template</code><s> ([temp.names])</s>, and then followed by an <em>id-expression</em>, is a postfix expression. The postfix expression before the dot or arrow is evaluated;<sup>[…]</sup> the result of that evaluation, together with the <em>id-expression</em>, determines the result of the entire postfix expression. <u>[<em>Note</em>: If the keyword <code>template</code> is used, the following unqualified name is considered to refer to a template ([temp.names]). If a <em>simple-template-id</em> results and is followed by a <code>::</code>, the <em>id-expression</em> is a <em>qualified-id</em>. — <em>end note</em>]</u></p>
</blockquote>
<p>Change paragraph 4:</p>
<blockquote>
<p>Otherwise, the object expression shall be of class type. The class type shall be complete unless the class member access appears in the definition of that class. [<em>Note</em>: <s>If the class is incomplete, lookup in</s><u>The program is ill-formed if the result differs from that when</u> the<u> class is</u> complete<s> class type is required to refer to the same declaration</s> ([<s>basic.scope.</s>class<u>.member.lookup</u>]). — <em>end note</em>] <s>The <em>id-expression</em> shall name a member of the class or of one of its base classes. [<em>Note</em>: Because the name of a class is inserted in its class scope ([class]), the name of a class is also considered a nested member of that class. — <em>end note</em>]</s> [<em>Note</em>: [basic.lookup.<s>classref</s><u>qual</u>] describes how names are looked up after the <code>.</code> and <code>-&gt;</code> operators. — <em>end note</em>]</p>
</blockquote>
<h3 id="expr.unary">[expr.unary]</h3>
<h4 id="expr.await">[expr.await]</h4>
<p>Change paragraph 2:</p>
<blockquote>
<p>[…] An <em>await-expression</em> shall not appear in the initializer of a block<s>-scope</s> variable with static or thread storage duration. A context within a function where an <em>await-expression</em> can appear is called a <em>suspension context</em> of the function.</p>
</blockquote>
<p>Change bullet (3.2):</p>
<blockquote>
<p><s><em>a</em> is the <em>cast-expression</em> if</s><u>Unless</u> the <em>await-expression</em> was implicitly produced by a <em>yield-expression</em> ([expr.yield]), an initial suspend point, or a final suspend point ([dcl.fct.def.coroutine])<s>. Otherwise</s>, <u>a search is performed for </u>the <s><em>unqualified-id</em></s><u>name</u> <code>await_transform</code> <s>is looked up with</s>in the scope of <code>P</code><s> by class member access lookup</s> ([<s>basic.</s><u>class.member.</u>lookup<s>.classref</s>])<s>, and i</s><u>. I</u>f this <s>lookup</s><u>search is performed and</u> finds at least one declaration, then <em>a</em> is <em>p</em><code>.await_transform(</code><em>cast-expression</em><code>)</code>; otherwise, <em>a</em> is the <em>cast-expression</em>.</p>
</blockquote>
<h4 id="expr.new">[expr.new]</h4>
<p>Change paragraph 11:</p>
<blockquote>
<p>If the <em>new-expression</em> <u>does not </u>begin<s>s</s> with a unary <code>::</code> operator<s>, the allocation function’s name is looked up in the global scope. Otherwise, if</s><u> and</u> the allocated type is a class type <code>T</code> or array thereof, <u>a search is performed for </u>the allocation function’s name <s>is looked up </s>in the scope of <code>T</code><u> ([class.member.lookup])</u>. <s>If this lookup fails to find the name, or if the allocated type is not a class type</s><u>Otherwise, or if nothing is found</u>, the allocation function’s name is looked up<u> by searching for it</u> in the global scope.</p>
</blockquote>
<p>Change paragraph 26:</p>
<blockquote>
<p>If the <em>new-expression</em> <u>does not </u>begin<s>s</s> with a unary <code>::</code> operator<s>, the deallocation function’s name is looked up in the global scope. Otherwise, if</s><u> and</u> the allocated type is a class type <code>T</code> or an array thereof, <u>a search is performed for </u>the deallocation function’s name <s>is looked up </s>in the scope of <code>T</code>. <s>If this lookup fails to find the name, or if the allocated type is not a class type or array thereof</s><u>Otherwise, or if nothing is found</u>, the deallocation function’s name is looked up<u> by searching for it</u> in the global scope.</p>
</blockquote>
<h4 id="expr.delete">[expr.delete]</h4>
<p>Change paragraph 8:</p>
<blockquote>
<p><u>If a deallocation function is called, it is <code>operator delete</code> for a single-object delete expression or <code>operator delete[]</code> for an array delete expression.</u> [<em>Note</em>: An implementation provides default definitions of the global deallocation functions<s> <code>operator delete</code> for non-arrays</s> ([new.delete.single]<s>) and <code>operator delete[]</code> for arrays (</s><u>, </u>[new.delete.array]). A C++ program can provide alternative definitions of these functions ([replacement.functions]), and/or class-specific versions ([class.free]). — <em>end note</em>]</p>
</blockquote>
<p>Change paragraph 9 (incorporating some of [class.free]/4):</p>
<blockquote>
<p><s>When</s><u>If</u> the keyword <code>delete</code> in a <em>delete-expression</em> is<u> not</u> preceded by the unary <code>::</code> operator<s>, the deallocation function’s name is looked up in global scope. Otherwise, the lookup considers class-specific deallocation functions ([class.free]).</s><u> and the type of the operand is a pointer to a (possibly cv-qualified) class type <code>T</code>:</u></p>
<ol style="list-style-type: decimal">
<li><u>If <code>T</code> has a virtual destructor, the deallocation function is the one selected at the point of definition of the dynamic type’s virtual destructor ([class.dtor]).</u></li>
<li><u>Otherwise, a search is performed for the deallocation function’s name in the scope of <code>T</code>.</u></li>
</ol>
<p><s>If no class-specific deallocation function</s><u>Otherwise, or if nothing</u> is found, the deallocation function’s name is looked up <u>by searching for it </u>in <u>the </u>global scope. <u>In any case, any declarations other than of usual deallocation functions ([basic.stc.dynamic.deallocation]) are discarded.<!-- remote --> [<em>Note</em>: If only a placement deallocation function is found in a class, the program is ill-formed because the lookup set is empty ([basic.lookup]). — <em>end note</em>]</u></p>
</blockquote>
<p>Change paragraph 10:</p>
<blockquote>
<p>If <s>deallocation function lookup finds </s>more than one <s>usual </s>deallocation function<u> is found</u>, the function to be called is selected as follows:</p>
<ol style="list-style-type: decimal">
<li>If any of the deallocation functions is a destroying operator delete, all deallocation functions that are not destroying operator deletes are eliminated from further consideration.</li>
<li>If the type has new-extended alignment, a function with a parameter of type <code>std::align_val_t</code> is preferred; otherwise a function without such a parameter is preferred. If any preferred functions are found, all non-preferred functions are eliminated from further consideration.</li>
<li>If exactly one function remains, that function is selected and the selection process terminates.</li>
<li>If the deallocation functions <s>have</s><u>belong to a</u> class scope, the one without a parameter of type <code>std::size_t</code> is selected.</li>
<li>If the type is complete and if, for an array delete expression only, the operand is a pointer to a class type with a non-trivial destructor or a (possibly multi-dimensional) array thereof, the function with a parameter of type <code>std::size_t</code> is selected.</li>
<li>Otherwise, it is unspecified whether a deallocation function with a parameter of type <code>std::size_t</code> is selected.</li>
</ol>
</blockquote>
<h3 id="expr.const">[expr.const]</h3>
<p>Change paragraph 13:</p>
<blockquote>
<p>An expression or conversion is in an <em>immediate function context</em> if it is potentially evaluated and its innermost <u>enclosing </u>non-block scope is a function parameter scope of an immediate function. An expression or conversion is an <em>immediate invocation</em> if it is an explicit or implicit invocation of an immediate function and is not in an immediate function context. An immediate invocation shall be a constant expression.</p>
</blockquote>
<p>Change bullet (15.7):</p>
<blockquote>
<p>a variable <s>whose name appears as</s><u>named by</u> a potentially constant evaluated expression that is either a constexpr variable or is of non-volatile const-qualified integral type or of reference type.</p>
</blockquote>
<h2 id="stmt.stmt">[stmt.stmt]</h2>
<h3 id="stmt.pre">[stmt.pre]</h3>
<div class="del">
Remove paragraph 5.
</div>
<p>Change paragraph 7:</p>
<blockquote>
<p>If a <em>condition</em> can be syntactically resolved as either an expression or <s>the</s><u>a</u> declaration<s> of a block-scope name</s>, it is interpreted as <s>a declaration</s><u>the latter</u>.</p>
</blockquote>
<h3 id="stmt.label">[stmt.label]</h3>
<p>Change paragraph 1:</p>
<blockquote>
<p>[…]</p>
<p>The optional <em>attribute-specifier-seq</em> appertains to the label. <s>An <em>identifier label</em> declares the identifier.</s> The only use of a<s>n identifier</s> label<u> with an <em>identifier</em></u> is as the target of a <code>goto</code>. <s>The scope of a label is the function in which it appears. L</s><u>No two l</u>abels <s>shall not be redeclared with</s>in a function<u> shall have the same <em>identifier</em></u>. A label can be used in a <code>goto</code> statement before its <s>declaration</s><u>introduction by a <em>labeled-statement</em></u>. <s>Labels have their own name space and do not interfere with other identifiers. [<em>Note</em>: A label may have the same name as another declaration in the same scope or a <em>template-parameter</em> from an enclosing scope. Unqualified name lookup ([basic.lookup.unqual]) ignores labels. — <em>end note</em>]</s></p>
</blockquote>
<h3 id="stmt.select">[stmt.select]</h3>
<p>Change paragraph 2:</p>
<blockquote>
<p><s>The substatement in a</s><u>[<em>Note</em>: Each</u> <em>selection-statement</em> <s>(</s><u>and </u>each substatement<s>, in the <code>else</code> form of the <code>if</code> statement</s><u> of a <em>selection-statement</em></u><s>)</s> <s>implicitly defines</s><u>has</u> a block scope ([basic.scope<u>.block</u>]).<u> — <em>end note</em>]</u> <s>If the substatement in a <em>selection-statement</em> is a single statement and not a <em>compound-statement</em>, it is as if it was rewritten to be a <em>compound-statement</em> containing the original substatement. [<em>Example</em>:</s></p>
<p><s>[…]</s></p>
<p><s>can be equivalently rewritten as</s></p>
<p><s>[…]</s></p>
<p><s>Thus after the <code>if</code> statement, <code>i</code> is no longer in scope. — <em>end example</em>]</s></p>
</blockquote>
<h4 id="stmt.if">[stmt.if]</h4>
<p>Change paragraph 3:</p>
<blockquote>
<p>[…]</p>
<p>except that <s>names declared in </s>the <em>init-statement</em> <s>are</s><u>is</u> in the same <s>declarative region</s><u>scope</u> as <s>those declared in </s>the <em>condition</em>.</p>
</blockquote>
<h4 id="stmt.switch">[stmt.switch]</h4>
<p>Change paragraph 7 as for [stmt.if]/3.</p>
<h3 id="stmt.iter">[stmt.iter]</h3>
<div class="del">
Remove paragraph 3.
</div>
<h4 id="stmt.while">[stmt.while]</h4>
<p>Change paragraph 2:</p>
<blockquote>
<p><s>When the condition of a <code>while</code> statement is a declaration, the scope of the variable that is declared extends from its point of declaration ([basic.scope.pdecl]) to the end of the <code>while</code> <em>statement</em>.</s> A <code>while</code> statement is equivalent to</p>
<p>[…]</p>
<p>[<em>Note</em>: The variable created in the condition is destroyed and created with each iteration of the loop. [<em>Example</em>:</p>
<p>[…]</p>
<p>In the while-loop, the constructor and destructor are each called twice, once for the condition that succeeds and once for the condition that fails. — <em>end example</em>] — <em>end note</em>]</p>
</blockquote>
<h4 id="stmt.for">[stmt.for]</h4>
<p>Change paragraph 1 as for [stmt.if]/3 (up to a comma instead of a period).</p>
<div class="del">
Remove paragraph 3 (whose example is moved to [basic.scope.block]).
</div>
<h4 id="stmt.ranged">[stmt.ranged]</h4>
<p>Change bullet (1.3.2):</p>
<blockquote>
<p>if the <em>for-range-initializer</em> is an expression of class type <code>C</code><s>, the <em>unqualified-id</em>⁠s</s><u> and searches in the scope of <code>C</code> ([class.member.lookup]) for the names</u> <code>begin</code> and <code>end</code> <s>are looked up in the scope of <code>C</code> as if by class member access lookup ([basic.lookup.classref]), and if both</s><u>each</u> find at least one declaration, <em>begin-expr</em> and <em>end-expr</em> are <em><code>range</code></em><code>.begin()</code> and <em><code>range</code></em><code>.end()</code>, respectively;</p>
</blockquote>
<h3 id="stmt.dcl">[stmt.dcl]</h3>
<p>Change paragraph 1:</p>
<blockquote>
<p>[…]</p>
<p><u>[<em>Note</em>: </u>If an identifier introduced by a declaration was previously declared in an outer block, the outer declaration is hidden for the remainder of the block<u> ([basic.lookup.unqual])</u>, after which it resumes its force.<u> — <em>end note</em>]</u></p>
</blockquote>
<p>Change paragraph 4:</p>
<blockquote>
<p>Dynamic initialization of a block<s>-scope</s> variable with static storage duration ([basic.stc.static]) or thread storage duration ([basic.stc.thread]) is performed the first time control passes through its declaration; such a variable is considered initialized upon the completion of its initialization. […]</p>
</blockquote>
<p>Change paragraph 5:</p>
<blockquote>
<p>A<u>n</u><s> block-scope</s> object <u>associated with a block variable </u>with static or thread storage duration will be destroyed if and only if it was constructed. [<em>Note</em>: [basic.start.term] describes the order in which <s>block-scope</s><u>such</u> objects<s> with static and thread storage duration</s> are destroyed. — <em>end note</em>]</p>
</blockquote>
<h3 id="stmt.ambig">[stmt.ambig]</h3>
<p>Change paragraph 3:</p>
<blockquote>
<p>[…] Disambiguation precedes parsing, and a statement disambiguated as a declaration may be an ill-formed declaration. If, during parsing, <u>lookup finds that </u>a name in a template <s>parameter is bound differently than it would be bound during a trial parse</s><u>argument is bound to (part of) the declaration being parsed</u>, the program is ill-formed. No diagnostic is required. <s>[<em>Note</em>: This can occur only when the name is declared earlier in the declaration. — <em>end note</em>]</s> [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<h2 id="dcl.dcl">[dcl.dcl]</h2>
<h3 id="dcl.pre">[dcl.pre]</h3>
<p>Change paragraph 4:</p>
<blockquote>
<p><s>A declaration occurs in a scope ([basic.scope]); the scope rules are summarized in [basic.lookup]. A</s><u>Certain</u> declaration<u>s</u> <s>that declares a function or defines a class, namespace, template, or function also has</s><u>contain</u> one or more scopes<s> nested within it</s><u> ([basic.scope.scope])</u>. <s>These nested scopes, in turn, can have declarations nested within them.</s> Unless otherwise stated, utterances in [dcl.dcl] about components in, of, or contained by a declaration or subcomponent thereof refer only to those components of the declaration that are <em>not</em> nested within scopes nested within the declaration.</p>
</blockquote>
<p>Change paragraph 5:</p>
<blockquote>
<p>In a <em>simple-declaration</em>, the optional <em>init-declarator-list</em> can be omitted only when declaring a class ([class<u>.pre</u>]) or enumeration ([dcl.enum]), that is, when the <em>decl-specifier-seq</em> contains either a <em>class-specifier</em>, an <em>elaborated-type-specifier</em> with a <em>class-key</em> ([class.name]), or an <em>enum-specifier</em>. In these cases and whenever a <em>class-specifier</em> or <em>enum-specifier</em> is present in the <em>decl-specifier-seq</em>, the identifiers in these specifiers are <s>among the names being</s><u>also</u> declared<s> by the declaration</s> (as <em>class-name</em>⁠s, <em>enum-name</em>⁠s, or <em>enumerator</em>⁠s, depending on the syntax). In such cases, the <em>decl-specifier-seq</em> shall <u>(re)</u>introduce one or more names into the program<s>, or shall redeclare a name introduced by a previous declaration</s>. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 9:</p>
<blockquote>
<p><s>Each <em>init-declarator</em> in the <em>init-declarator-list</em> contains exactly one <em>declarator-id</em>, which is the</s><u>If a <em>declarator-id</em> is a</u> name<u>, the</u> <s>declared by that </s><em>init-declarator</em> and <u>(</u>hence<u>)</u> <s>one of the names declared by </s>the declaration<u> introduce that name</u>. <u>[<em>Note</em>: Otherwise, the <em>declarator-id</em> is a <em>qualified-id</em> or names a destructor or its <em>unqualified-id</em> is a <em>template-id</em> and no name is introduced. — <em>end note</em>]</u> The <em>defining-type-specifier</em>⁠s ([dcl.type]) in the <em>decl-specifier-seq</em> and the recursive <em>declarator</em> structure<s> of the <em>init-declarator</em></s> describe a type ([dcl.meaning]), which is then associated with the <s>name being declared by the <em>init-declarator</em></s><u><em>declarator-id</em></u>.</p>
</blockquote>
<p>Change paragraph 10:</p>
<blockquote>
<p>If the <em>decl-specifier-seq</em> contains the <code>typedef</code> specifier, the declaration is called a <em>typedef declaration</em><u>, each <em>declarator-id</em> must be an <em>identifier</em>,</u> and <s>the name of </s>each<s> <em>init-declarator</em></s> is declared to be a <em>typedef-name</em>, synonymous with its associated type ([dcl.typedef]). If the <em>decl-specifier-seq</em> contains no <code>typedef</code> specifier, the declaration is called a <em>function declaration</em> if the type associated with <s>the name</s><u>a <em>declarator-id</em></u> is a function type ([dcl.fct]) and an <em>object declaration</em> otherwise.</p>
</blockquote>
<h3 id="dcl.spec">[dcl.spec]</h3>
<h4 id="dcl.stc">[dcl.stc]</h4>
<p>Change paragraph 6:</p>
<blockquote>
<p><s>The linkages implied by successive</s><u>All</u> declarations for a given entity shall <s>agree</s><u>give its name the same linkage</u>. <s>That is, within a given scope, each declaration declaring the same variable name or the same overloading of a function name shall imply the same linkage.</s> <u>[<em>Note</em>: The linkage given by some declarations is affected by previous declarations. Overloaded functions are distinct entities. — <em>end note</em>]</u> [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<h4 id="dcl.typedef">[dcl.typedef]</h4>
<p>Change paragraph 2:</p>
<blockquote>
<p>A <em>typedef-name</em> can also be introduced by an <em>alias-declaration</em>. The <em>identifier</em> following the <code>using</code> keyword<u> is not looked up; it</u> becomes a <em>typedef-name</em> and the optional <em>attribute-specifier-seq</em> following the <em>identifier</em> appertains to that <em>typedef-name</em>. […]</p>
</blockquote>
<div class="del">
Remove paragraphs 3 through 7.
</div>
<h4 id="dcl.inline">[dcl.inline]</h4>
<p>Change paragraph 6:</p>
<blockquote>
<p>[<em>Note</em>: An inline function or variable with external or module linkage <s>has the same address</s><u>can be defined</u> in <s>all</s><u>multiple</u> translation units<u> ([basic.def.odr]), but is one entity with one address</u>. A <u>type or </u><code>static</code> <s>local </s>variable<u> defined</u> in <s>an inline</s><u>the body of such a</u> function <s>with external or module linkage always refers to the same object</s><u>is therefore a single entity</u>. <s>A type defined within the body of an inline function with external or module linkage is the same type in every translation unit.</s> — <em>end note</em>]</p>
</blockquote>
<h4 id="dcl.type">[dcl.type]</h4>
<h5 id="dcl.type.simple">[dcl.type.simple]</h5>
<p>Insert before paragraph 2:</p>
<div class="ins">
<blockquote>
<p>The component names of a <em>simple-type-specifier</em> are those of its <em>nested-name-specifier</em>, <em>type-name</em>, <em>simple-template-id</em>, <em>template-name</em>, and/or <em>type-constraint</em> (if it is a <em>placeholder-type-specifier</em>). The component name of a <em>type-name</em> is the first name in it.</p>
</blockquote>
</div>
<h5 id="dcl.type.elab">[dcl.type.elab]</h5>
<p>Insert before paragraph 1:</p>
<div class="ins">
<blockquote>
<p>The component names of an <em>elaborated-type-specifier</em> are its <em>identifier</em> (if any) and those of its <em>nested-name-specifier</em> and <em>simple-template-id</em> (if any).</p>
</blockquote>
</div>
<p>Change paragraph 1:</p>
<blockquote>
<p><s>An <em>attribute-specifier-seq</em> shall not appear in an <em>elaborated-type-specifier</em> unless the latter is the sole constituent of a declaration.</s> If an <em>elaborated-type-specifier</em> is the sole constituent of a declaration, the declaration is ill-formed unless it is an explicit specialization ([temp.expl.spec]), an explicit instantiation ([temp.explicit]) or it has one of the following forms:</p>
<blockquote>
<p><em>class-key</em> <em>attribute-specifier-seq</em><sub><em>opt</em></sub> <em>identifier</em> <code>;</code><br /><u><em>class-key</em> <em>attribute-specifier-seq</em><sub><em>opt</em></sub> <em>simple-template-id</em> <code>;</code></u><br /><s><code>friend</code> <em>class-key</em> <code>::</code><sub><em>opt</em></sub> <em>identifier</em> <code>;</code><br /><code>friend</code> <em>class-key</em> <code>::</code><sub><em>opt</em></sub> <em>simple-template-id</em> <code>;</code><br /><code>friend</code> <em>class-key</em> <em>nested-name-specifier</em> <em>identifier</em> <code>;</code><br /><code>friend</code> <em>class-key</em> <em>nested-name-specifier</em> <code>template</code><sub><em>opt</em></sub> <em>simple-template-id</em> <code>;</code></s></p>
</blockquote>
<p>In the first case, <u>it declares the <em>identifier</em> as a <em>class-name</em>. The second case shall appear only in a <em>template-declaration</em>; it declares a partial specialization ([temp.class.spec]). T</u><s>t</s>he <em>attribute-specifier-seq</em>, if any, appertains to the class<u> or template</u> being declared<s>; the attributes in the <em>attribute-specifier-seq</em> are thereafter considered attributes of the class whenever it is named</s>.</p>
</blockquote>
<p>Insert before paragraph 2:</p>
<div class="ins">
<blockquote>
<p>Otherwise, the <em>elaborated-type-specifier</em> shall not have an <em>attribute-specifier-seq</em>. If it contains a <em>identifier</em> but no <em>nested-name-specifier</em> and (unqualified) lookup for the <em>identifier</em> finds nothing, it shall not be introduced by the <code>enum</code> keyword and declares the <em>identifier</em> as a <em>class-name</em>. Its target scope is the nearest enclosing namespace or block scope.</p>
</blockquote>
<blockquote>
<p>If it appears with the <code>friend</code> specifier as an entire declaration, the declaration shall have one of the following forms:</p>
<blockquote>
<p><code>friend</code> <em>class-key</em> <em>nested-name-specifier</em><sub><em>opt</em></sub> <em>identifier</em> <code>;</code><br /><code>friend</code> <em>class-key</em> <em>simple-template-id</em> <code>;</code><br /><code>friend</code> <em>class-key</em> <em>nested-name-specifier</em> <code>template</code><sub><em>opt</em></sub> <em>simple-template-id</em> <code>;</code></p>
</blockquote>
<p>Lookup for the <em>identifier</em> does not consider scopes that contain the target scope; no name is bound.<!-- remote --> [<em>Note</em>: [basic.lookup.elab] describes how name lookup proceeds in an <em>elaborated-type-specifier</em>. — <em>end note</em>]</p>
</blockquote>
</div>
<p>Change paragraph 2:</p>
<blockquote>
<p>[<em>Note</em>: <s>[basic.lookup.elab] describes how name lookup proceeds for the <em>identifier</em> in a</s><u>A</u>n <em>elaborated-type-specifier</em><u> may be used to refer to a previously declared <em>class-name</em> or <em>enum-name</em> even if the name has been hidden by a non-type declaration</u>. — <em>end note</em>] If the <em>identifier</em> or <em>simple-template-id</em> resolves to a <em>class-name</em> or <em>enum-name</em>, the <em>elaborated-type-specifier</em> introduces it into the declaration the same way a <em>simple-type-specifier</em> introduces its <em>type-name</em> ([dcl.type.simple]). […]</p>
</blockquote>
<h5 id="dcl.spec.auto">[dcl.spec.auto]</h5>
<p>Change paragraph 11:</p>
<blockquote>
<p>If <s>the name of</s> a<s>n entity</s><u> variable or function</u> with an undeduced placeholder type <s>appears in</s><u>is named by</u> an expression<u> ([basic.def.odr])</u>, the program is ill-formed. Once a non-discarded <code>return</code> statement has been seen in a function, however, the return type deduced from that statement can be used in the rest of the function, including in other <code>return</code> statements. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 13:</p>
<blockquote>
<u>If a function or function template has a declared return type that uses a placeholder type, r</u><s>R</s>edeclarations or specializations<u> (respectively)</u> of <s>a function or function template with a declared return type that uses a placeholder type</s><u>it</u> shall <s>also </s>use that placeholder, not a deduced type<s>. Similarly, redeclarations or specializations of a function or function template with a declared return type that does not use a placeholder type</s><u>; otherwise, they</u> shall not use a placeholder.
<pre class="cpp">
[&hellip;]
int f();                                        // error: <s>cannot be overloaded with </s>auto <s>f()</s><u>and int don't match</u>
[&hellip;]
</pre>

</blockquote>
<h3 id="dcl.decl">[dcl.decl]</h3>
<p>Change paragraph 1:</p>
<blockquote>
<p>A declarator declares a single variable, function, or type, within a declaration. The <em>init-declarator-list</em> appearing in a <s>declaration</s><u><em>simple-declaration</em></u> is a comma-separated sequence of declarators, each of which can have an initializer.</p>
<p>[…]</p>
</blockquote>
<p>Change paragraph 2:</p>
<blockquote>
<p><s>The three components of a <em>simple-declaration</em> are the attributes ([dcl.attr]), the specifiers (<em>decl-specifier-seq</em>; [dcl.spec]) and the declarators (<em>init-declarator-list</em>).</s> <u>In all contexts, a <em>declarator</em> is interpreted as given below. Where an <em>abstract-declarator</em> can be used (or omitted) in place of a <em>declarator</em> ([dcl.fct], [except.pre]), it is as if a unique identifier were included in the appropriate place ([dcl.name])</u>. The <u>preceding </u>specifiers indicate the type, storage class or other properties of the <u>entity or </u>entities being declared. <s>The</s><u>Each</u> declarator<s>s</s> specif<s>y</s><u>ies</u> <s>the names of these</s><u>one</u> entit<s>ies</s><u>y</u> and (optionally) <u>names it and/or </u>modif<s>y</s><u>ies</u> the type of the specifiers with operators such as <code>*</code> (pointer to) and <code>()</code> (function returning). <s>Initial values</s><u>[<em>Note</em>: An <em>init-declarator</em> </u> can also <s>be </s>specif<s>ied in a declarator;</s><u>y an</u> initializer<s>s are discussed in</s> <u>(</u>[dcl.init]<s> and [class.init]</s><u>)</u>.<u> — <em>end note</em>]</u></p>
</blockquote>
<p>Change paragraph 3:</p>
<blockquote>
<p>Each <em>init-declarator</em><u> or <em>member-declarator</em></u> in a declaration is analyzed separately as if it <s>was</s><u>were</u> in a declaration by itself. [<em>Note</em>: A declaration with several declarators is usually equivalent to the corresponding sequence of declarations each with a single declarator. That is<u>,</u></p>
<pre class="sourceCode cpp"><code class="sourceCode cpp">T D1, D2, ... Dn;</code></pre>
<p>is usually equivalent to</p>
<pre class="sourceCode cpp"><code class="sourceCode cpp">T D1; T D2; ... T Dn;</code></pre>
<p>where <code>T</code> is a <em>decl-specifier-seq</em> and each <code>Di</code> is an <em>init-declarator</em><u> or <em>member-declarator</em></u>. […]</p>
<p>— <em>end note</em>]</p>
</blockquote>
<h4 id="dcl.meaning">[dcl.meaning]</h4>
<p>Change paragraph 1:</p>
<blockquote>
<p>A declarator contains exactly one <em>declarator-id</em>; it names the <s>identifier</s><u>entity</u> that is declared. <s>An</s><u>If the</u> <em>unqualified-id</em> occurring in a <em>declarator-id</em> <s>shall be</s><u>is</u> a <s>simple <em>identifier</em> except for the declaration of some special</s><u><em>template-id</em>, the declarator shall appear in the <em>declaration</em> of a <em>template-declaration</em> ([temp.class.spec]), <em>explicit-specialization</em> ([temp.expl.spec]), or <em>explicit-instantiation</em> ([temp.explicit]). [<em>Note</em>: An <em>unqualified-id</em> that is not an <em>identifier</em> is used to declare certain</u> functions (<s>[class.ctor], </s>[class.conv<u>.fct</u>], [class.dtor], [over.oper]<u>, [over.literal]</u>)<s> and for the declaration of template specializations or partial specializations ([temp.spec])</s>.<u> — _end note]</u> <s>When the <em>declarator-id</em> is qualified, the declaration shall refer to a previously declared member of the class or namespace to which the qualifier refers (or, in the case of a namespace, of an element of the inline namespace set of that namespace ([namespace.def])) or to a specialization thereof; the member shall not merely have been introduced by a <em>using-declaration</em> in the scope of the class or namespace nominated by the <em>nested-name-specifier</em> of the <em>declarator-id</em>. The <em>nested-name-specifier</em> of a qualified <em>declarator-id</em> shall not begin with a <em>decltype-specifier</em>. [<em>Note</em>: If the qualifier is the global <code>::</code> scope resolution operator, the <em>declarator-id</em> refers to a name declared in the global namespace scope. — <em>end note</em>]</s> The optional <em>attribute-specifier-seq</em> following a <em>declarator-id</em> appertains to the entity that is declared.</p>
</blockquote>
<p>Insert before paragraph 2, including the examples from [namespace.memdef]/2 and from [basic.link]/7, with changes as marked for the latter:</p>
<div class="ins">
<blockquote>
<p>If the <em>id-expression</em> <em>E</em> in a <em>declarator-id</em> of a friend declaration is a <em>qualified-id</em> or a <em>template-id</em>:</p>
<ol style="list-style-type: decimal">
<li>If the friend declaration is not a template declaration, then in the lookup for the terminal name of <em>E</em>:
<ol style="list-style-type: decimal">
<li>if the <em>unqualified-id</em> in <em>E</em> is a <em>template-id</em>, all function declarations are discarded;</li>
<li>otherwise, if the <em>declarator</em> corresponds ([basic.scope.scope]) to any declaration found of a non-template function, all function template declarations are discarded;</li>
<li>each remaining function template is replaced with the specialization chosen by deduction from the friend declaration ([temp.deduct.decl]) or discarded if deduction fails.</li>
</ol></li>
<li>The <em>declarator</em> shall correspond to one or more declarations found by the lookup; they shall all have the same target scope, and the target scope of the <em>declarator</em> is that scope.</li>
</ol>
</blockquote>
<blockquote>
<p>Otherwise, the terminal name of a <em>declarator-id</em> is not looked up.</p>
<ol style="list-style-type: decimal">
<li>If the declaration is a friend declaration, its target scope is the innermost enclosing namespace scope; if the declaration is contained by a block scope, it shall correspond to a declaration that inhabits the innermost block scope. The <em>declarator</em> binds no name.</li>
<li>If the <em>id-expression</em> in the <em>declarator-id</em> is a <em>qualified-id</em> or <em>template-id</em> or the <em>declarator</em> is part of the <em>declaration</em> of an <em>explicit-instantiation</em> or <em>explicit-specialization</em>:
<ol style="list-style-type: decimal">
<li>If the <em>id-expression</em> is a <em>qualified-id</em>, let <em>S</em> be its lookup context ([basic.lookup.qual]). The declaration shall inhabit a namespace scope.</li>
<li>Otherwise, let <em>S</em> be the entity associated with the immediate scope of the <em>id-expression</em>.</li>
</ol>
<p>The <em>declarator</em> shall correspond to one or more declarations nominable in <em>S</em> or declare a specialization of an entity declared by such a declaration. In the former case, all the declarations shall have the same target scope and the target scope of the <em>declarator</em> is that scope. [<em>Example</em>:</p>
<p>[… from [namespace.memdef]/2]</p>
— <em>end example</em>]</li>
<li><p>If the declaration inhabits a block scope <em>S</em> and declares a function ([dcl.fct]) or uses the <code>extern</code> specifier, the declaration shall not be attached to a named module ([module.unit]) and its target scope is the innermost enclosing namespace scope, but the name is bound in <em>S</em>. [<em>Example</em>:<!-- FIXME: the <pre> shouldn't be outside the list --></p></li>
</ol>
<pre class="cpp">
namespace X {
  void p() {
    q();                        // error: q not yet declared
    extern void q();            // q is a member of namespace X<u>
    extern void r();            // r is a member of namespace X</u>
  }

  void middle() {
    q();                        // error: q not <s>yet declared</s><u>found</u>
  }

  void q() { /* ... */ }        // definition of X::q
}

void q() { /* ... */ }          // some other, unrelated q<u>
void X::r() { /* ... */ } // error: r cannot be declared by qualified-id</u>
</pre>
<p>— <em>end example</em>]</p>
</blockquote>
</div>
<p>[<em>Drafting note</em>: Richard proposed making the restriction on use of a <em>qualified-id</em> grammatical. — <em>end drafting note</em>]</p>
<p>Change paragraph 2:</p>
<blockquote>
<p>A <code>static</code>, <code>thread_local</code>, <code>extern</code>, <code>mutable</code>, <code>friend</code>, <code>inline</code>, <code>virtual</code>, <code>constexpr</code>, or <code>typedef</code> specifier or an <em>explicit-specifier</em> applies directly to each <em>declarator-id</em> in a<s>n <em>init-declarator-list</em> or <em>member-declarator-list</em></s><u> declaration</u>; the type specified for each <em>declarator-id</em> depends on both the <em>decl-specifier-seq</em> and its <em>declarator</em>.</p>
</blockquote>
<p>Change paragraph 3:</p>
<blockquote>
<p>Thus, <u>(for each <em>declarator</em>) </u>a declaration<s> of a particular identifier</s> has the form</p>
<pre class="sourceCode cpp"><code class="sourceCode cpp">T D</code></pre>
<p>where <code>T</code> is of the form <em>attribute-specifier-seq</em><sub><em>opt</em></sub> <em>decl-specifier-seq</em> and <code>D</code> is a declarator. Following is a recursive procedure for determining the type specified for the contained <em>declarator-id</em> by such a declaration.</p>
</blockquote>
<p>Change paragraph 5:</p>
<blockquote>
<p>In a declaration <em>attribute-specifier-seq</em><sub><em>opt</em></sub> <code>T</code> <code>D</code> where <code>D</code> is an unadorned <s>identifier</s><u>name</u> the type of <s>this identifier</s><u>the declared entity</u> is “<code>T</code>”.</p>
</blockquote>
<h5 id="dcl.ptr">[dcl.ptr]</h5>
<p>Change paragraph 1:</p>
<blockquote>
<p>In a declaration <code>T</code> <code>D</code> where <code>D</code> has the form</p>
<blockquote>
<p><code>*</code> <em>attribute-specifier-seq</em><sub><em>opt</em></sub> <em>cv-qualifier-seq</em><sub><em>opt</em></sub> <code>D1</code></p>
</blockquote>
<p>and the type of the <s>identifier</s><u>contained <em>declarator-id</em></u> in the declaration <code>T</code> <code>D1</code> is “<em>derived-declarator-type-list</em> <code>T</code>”, <s>then </s>the type of the <s>identifier of</s><u><em>declarator-id</em> in</u> <code>D</code> is “<em>derived-declarator-type-list</em> <em>cv-qualifier-seq</em> pointer to <code>T</code>”. […]</p>
</blockquote>
<h5 id="dcl.ref">[dcl.ref]</h5>
<p>Change paragraph 1:</p>
<blockquote>
<p>In a declaration <code>T</code> <code>D</code> where <code>D</code> has either of the forms</p>
<blockquote>
<p><code>&amp;</code> <em>attribute-specifier-seq</em><sub><em>opt</em></sub> <code>D1</code><br /><code>&amp;&amp;</code> <em>attribute-specifier-seq</em><sub><em>opt</em></sub> <code>D1</code></p>
</blockquote>
<p>and the type of the <s>identifier</s><u>contained <em>declarator-id</em></u> in the declaration <code>T</code> <code>D1</code> is “<em>derived-declarator-type-list</em> <code>T</code>”, <s>then </s>the type of the <s>identifier of</s><u><em>declarator-id</em> in</u> <code>D</code> is “<em>derived-declarator-type-list</em> reference to <code>T</code>”. […]</p>
</blockquote>
<h5 id="dcl.mptr">[dcl.mptr]</h5>
<p>Prepend paragraph:</p>
<div class="ins">
<blockquote>
<p>The component names of a <em>ptr-operator</em> are those of its <em>nested-name-specifier</em>, if any.</p>
</blockquote>
</div>
<p>Change paragraph 1:</p>
<blockquote>
<p>In a declaration <code>T</code> <code>D</code> where <code>D</code> has the form</p>
<blockquote>
<p><em>nested-name-specifier</em> <code>*</code> <em>attribute-specifier-seq</em><sub><em>opt</em></sub> <em>cv-qualifier-seq</em><sub><em>opt</em></sub> <code>D1</code></p>
</blockquote>
<p>and the <em>nested-name-specifier</em> denotes a class, and the type of the <s>identifier</s><u>contained <em>declarator-id</em></u> in the declaration <code>T</code> <code>D1</code> is “<em>derived-declarator-type-list</em> <code>T</code>”, <s>then </s>the type of the <s>identifier of</s><u><em>declarator-id</em> in</u> <code>D</code> is “<em>derived-declarator-type-list</em> <em>cv-qualifier-seq</em> pointer to member of class <em>nested-name-specifier</em> of type <code>T</code>”. […]</p>
</blockquote>
<h5 id="dcl.fct">[dcl.fct]</h5>
<p>Change paragraph 5, appending an example adapted from [over.load]/3:</p>
<blockquote>
<p>The type of a function is determined using the following rules. The type of each parameter (including function parameter packs) is determined from its own <s><em>decl-specifier-seq</em> and <em>declarator</em></s><u><em>parameter-declaration</em> ([dcl.decl])</u>. […][<em>Note</em>: This transformation does not affect the types of the parameters. For example, <code>int(*)(const int p, decltype(p)*)</code> and <code>int(*)(int, const int*)</code> are identical types. — <em>end note</em>] <u>[<em>Example</em>:</u></p>
<pre class="sourceCode cpp ins"><code class="sourceCode cpp"><span class="dt">void</span> f(<span class="dt">char</span>*);             <span class="co">// #1</span>
<span class="dt">void</span> f(<span class="dt">char</span>[]) {}          <span class="co">// defines #1</span>
<span class="dt">void</span> f(<span class="dt">const</span> <span class="dt">char</span>*) {}     <span class="co">// OK: overloads #1</span>
<span class="dt">void</span> f(<span class="dt">char</span> *<span class="dt">const</span>) {}     <span class="co">// error: redefines #1</span>

<span class="dt">void</span> g(<span class="dt">char</span>(*)[<span class="dv">2</span>]);        <span class="co">// #2</span>
<span class="dt">void</span> g(<span class="dt">char</span>[<span class="dv">3</span>][<span class="dv">2</span>]) {}      <span class="co">// defines #2</span>
<span class="dt">void</span> g(<span class="dt">char</span>[<span class="dv">3</span>][<span class="dv">3</span>]) {}      <span class="co">// OK: overloads #2</span>

<span class="dt">void</span> h(<span class="dt">int</span> x(<span class="dt">const</span> <span class="dt">int</span>));  <span class="co">// #3</span>
<span class="dt">void</span> h(<span class="dt">int</span> (*)(<span class="dt">int</span>)) {}    <span class="co">// defines #3</span></code></pre>
<p><u>— <em>end example</em>]</u></p>
</blockquote>
<p>Change paragraph 10:</p>
<blockquote>
<p><u>[<em>Note</em>: </u>A single name can be used for several different functions in a single scope; this is function overloading ([over]).<u> — <em>end note</em>]</u> <s>All declarations for a function shall have equivalent return types, parameter-type-lists, and <em>requires-clause</em>⁠s ([temp.over.link]).</s></p>
</blockquote>
<p>Change paragraph 15:</p>
<blockquote>
<p>An identifier can optionally be provided as a parameter name; if present in a function definition ([dcl.fct.def]), it names a parameter. [<em>Note</em>: In particular, parameter names are also optional in function definitions and names used for a parameter in different declarations and the definition of a function need not be the same. <s>If a parameter name is present in a function declaration that is not a definition, it cannot be used outside of its function declarator because that is the extent of its potential scope ([basic.scope.param]).</s> — <em>end note</em>]</p>
</blockquote>
<h5 id="dcl.fct.default">[dcl.fct.default]</h5>
<p>Change paragraph 4:</p>
<blockquote>
<p>For non-template functions, default arguments can be added in later declarations of a function <s>in</s><u>that inhabit</u> the same scope. Declarations <s>in</s><u>that inhabit</u> different scopes have completely distinct sets of default arguments. That is, declarations in inner scopes do not acquire default arguments from declarations in outer scopes, and vice versa. […]</p>
</blockquote>
<p>Change paragraph 5:</p>
<blockquote>
<p>The default argument has the same semantic constraints as the initializer in a declaration of a variable of the parameter type, using the copy-initialization semantics ([dcl.init]). The names in the default argument are <s>bound</s><u>looked up</u>, and the semantic constraints are checked, at the point where the default argument appears. Name lookup and checking of semantic constraints for default arguments in function templates and in member functions of class templates are performed as described in [temp.inst]. [<em>Example</em>: In the following code, <code>g</code> will be called with the value <code>f(2)</code>:</p>
<p>[…]</p>
<p>— <em>end example</em>] [<em>Note</em>: <s>In member function declarations, names in default arguments are looked up as described in [basic.lookup.unqual].</s> <u>A default argument is a complete-class context ([class.mem]).</u> Access checking applies to names in default arguments as described in [class.access]. — <em>end note</em>]</p>
</blockquote>
<p>Change paragraph 9:</p>
<blockquote>
<p>A default argument is evaluated each time the function is called with no argument for the corresponding parameter. A parameter shall not appear as a potentially-evaluated expression in a default argument. <u>[<em>Note</em>: </u>Parameters of a function declared before a default argument are in scope and can hide namespace and class member names.<u> — <em>end note</em>]</u> [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>] A non-static member shall not appear in a default argument unless it appears as the <em>id-expression</em> of a class member access expression ([expr.ref]) or unless it is used to form a pointer to member ([expr.unary.op]). [<em>Example</em>: The declaration of <code>X::mem1()</code> in the following example is ill-formed because no object is supplied for the non-static member <code>X::a</code> used as an initializer.</p>
<p>[…]</p>
<p>The declaration of <code>X::mem2()</code> is meaningful, however, since no object is needed to access the static member <code>X::b</code>. Classes, objects, and members are described in [class.pre]. — <em>end example</em>] A default argument is not part of the type of a function. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>] When a declaration of a function<u> in a scope <em>S</em></u> is <s>introduced</s><u>named</u> by <s>way of </s>a <em>using-declarat<s>ion</s><u>or</u></em> ([namespace.udecl]), any default argument<s> information</s> associated with <s>the</s><u>any</u> declaration <s>is made known as well</s><u><em>D</em> in <em>S</em> is available to any call from which <em>D</em> is reachable</u>. <s>If the function is redeclared thereafter in the namespace with additional default arguments, the additional arguments are also known at any point following the redeclaration where the <em>using-declaration</em> is in scope.</s> <u>[<em>Note</em>: <em>D</em> need not be reachable from the <em>using-declaration</em>. — <em>end note</em>]</u></p>
</blockquote>
<h3 id="dcl.init">[dcl.init]</h3>
<p>Change paragraph 5:</p>
<blockquote>
<p>A declaration of a block<s>-scope</s> variable with <s>external or internal </s>linkage that has an <em>initializer</em> is ill-formed.</p>
</blockquote>
<div class="del">
Remove paragraph 13.
</div>
<h4 id="dcl.init.aggr">[dcl.init.aggr]</h4>
<p>Change bullet (4.1):</p>
<blockquote>
<p>If the element is an anonymous union <s>object</s><u>member</u> and the initializer list is a <em>designated-initializer-list</em>, the <s>anonymous union object</s><u>element</u> is initialized by the <em>designated-initializer-list</em> <code>{</code><em>D</em><code>}</code>, where <em>D</em> is the <em>designated-initializer-clause</em> naming a member of the anonymous union <s>object</s><u>member</u>. […]</p>
</blockquote>
<h3 id="dcl.fct.def">[dcl.fct.def]</h3>
<h4 id="dcl.fct.def.general">[dcl.fct.def.general]</h4>
<p>Change paragraph 7:</p>
<blockquote>
<p><s>In the <em>function-body</em>, a</s><u>A</u> <em>function-local predefined variable</em> <s>denotes a block-scope object of</s><u>is a variable with</u> static storage duration that is implicitly defined <s>(see [basic.scope.block])</s><u>in a function parameter scope</u>.</p>
</blockquote>
<h4 id="dcl.fct.def.coroutine">[dcl.fct.def.coroutine]</h4>
<p>Change paragraph 10:</p>
<blockquote>
<p><s>The <em>unqualified-id</em></s><u>If a search for the name</u> <code>get_return_object_on_allocation_failure</code><s> is looked up</s> in the scope of the promise type<s> by class member access lookup</s> ([<s>basic</s><u>class.member</u>.lookup<s>.classref</s>])<s>. If</s><u>finds</u> any declarations<s> are found</s>, then the result of a call to an allocation function used to obtain storage for the coroutine state is assumed to return <code>nullptr</code> if it fails to obtain storage, and if a global allocation function is selected, the <code>::operator new(size_t, nothrow_t)</code> form is used. […]</p>
</blockquote>
<h3 id="dcl.struct.bind">[dcl.struct.bind]</h3>
<p>Change paragraph 4:</p>
<blockquote>
<p>Otherwise, if the <em>qualified-id</em> <code>std::tuple_size&lt;E&gt;</code> names a complete class type with a member named <code>value</code>, the expression <code>std::tuple_size&lt;E&gt;::value</code> shall be a well-formed integral constant expression and the number of elements in the <em>identifier-list</em> shall be equal to the value of that expression. Let <code>i</code> be an index prvalue of type <code>std::size_t</code> corresponding to <code>v</code><sub><em>i</em></sub>. <s>The <em>unqualified-id</em></s><u>If a search for the name</u> <code>get</code><s> is looked up</s> in the scope of <code>E</code><s> by class member access lookup</s> ([<s>basic</s><u>class.member</u>.lookup<s>.classref</s>])<s>, and if that</s> finds at least one declaration that is a function template whose first template parameter is a non-type parameter, the initializer is <em><code>e</code></em><code>.get&lt;i&gt;()</code>. Otherwise, the initializer is <code>get&lt;i&gt;(</code><em><code>e</code></em><code>)</code>, where <code>get</code> <s>is</s><u>undergoes argument-dependent</u> look<s>ed </s>up<s> in the associated namespaces</s> ([basic.lookup.argdep]). In either case, <code>get&lt;i&gt;</code> is interpreted as a <em>template-id</em>. [<em>Note</em>: Ordinary unqualified lookup ([basic.lookup.unqual]) is not performed. — <em>end note</em>][…]</p>
</blockquote>
<h3 id="enum">[enum]</h3>
<h4 id="dcl.enum">[dcl.enum]</h4>
<p>Change paragraph 4:</p>
<blockquote>
<p>If an <em>enum-head-name</em> contains a <em>nested-name-specifier</em>, <s>it shall not begin with a <em>decltype-specifier</em> and </s>the enclosing <em>enum-specifier</em> or <em>opaque-enum-declaration</em><u> <em>D</em></u> shall <s>refer to an enumeration that was previously declared directly</s><u>not inhabit a class scope and shall correspond to one or more declarations nominable</u> in the class<u>, class template,</u> or namespace to which the <em>nested-name-specifier</em> refers<s>, or in an element of the inline namespace set ([namespace.def]) of that namespace (i.e., neither inherited nor introduced by a <em>using-declaration</em>), and the <em>enum-specifier</em> or <em>opaque-enum-declaration</em> shall appear in a namespace enclosing the previous declaration</s><u> ([basic.scope.scope])</u>. <u>All those declarations shall have the same target scope; the target scope of <em>D</em> is that scope.</u></p>
</blockquote>
<p>Change paragraph 6:</p>
<blockquote>
<p>An enumeration whose underlying type is fixed is an incomplete type <s>from its point of declaration ([basic.scope.pdecl]) to</s><u>until</u> immediately after its <em>enum-base</em> (if any), at which point it becomes a complete type. An enumeration whose underlying type is not fixed is an incomplete type <s>from its point of declaration to immediately after</s><u>until</u> the closing <code>}</code> of its <em>enum-specifier</em>, at which point it becomes a complete type.</p>
</blockquote>
<p>Change paragraph 11:</p>
<blockquote>
<p><s>Each <em>enum-name</em> and</s><u>The name of</u> each unscoped <s><em>enumerator</em></s><u>enumerator</u> is <s>declared</s><u>also bound</u> in the scope that immediately contains the <em>enum-specifier</em>. <s>Each scoped <em>enumerator</em> is declared in the scope of the enumeration.</s> An unnamed enumeration that does not have a typedef name for linkage purposes ([dcl.typedef]) and that has a first enumerator is denoted, for linkage purposes ([basic.link]), by its underlying type and its first enumerator; such an enumeration is said to have an enumerator as a name for linkage purposes. <s>These names obey the scope rules defined for all names in [basic.scope] and [basic.lookup].</s> [<em>Note</em>: Each unnamed enumeration with no enumerators is a distinct type. — <em>end note</em>] [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>] <s>An enumerator declared in class scope can be referred to using the class member access operators (<code>::</code>, <code>.</code> (dot) and <code>-&gt;</code> (arrow)), see [expr.ref]. [<em>Example</em>:</s></p>
<p><s>[…]</s></p>
<p><s>— <em>end example</em>]</s></p>
</blockquote>
<h4 id="enum.udecl">[enum.udecl]</h4>
<p>Change paragraph 2:</p>
<blockquote>
<p>A <em>using-enum-declaration</em> <s>introduces the enumerator names of the named enumeration as if by</s><u>is equivalent to</u> a <em>using-declaration</em> for each enumerator.</p>
</blockquote>
<p>Change paragraph 3:</p>
<blockquote>
<p>[<em>Note</em>: A <em>using-enum-declaration</em> in class scope <s>adds</s><u>makes</u> the enumerators of the named enumeration <s>as members to the scope. This means they are accessible for</s><u>available via</u> member lookup. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>] — <em>end note</em>]</p>
</blockquote>
<h3 id="basic.namespace">[basic.namespace]</h3>
<p>Change paragraph 1:</p>
<blockquote>
<p>A namespace is an optionally-named <s>declarative region</s><u>entity whose scope can contain declarations of any kind of entity</u>. The name of a namespace can be used to access entities <s>declared in</s><u>that belong to</u> that namespace; that is, the <s>members</s><u><em>members</em></u> of the namespace. Unlike other <s>declarative regions</s><u>entities</u>, the definition of a namespace can be split over several parts of one or more translation units<u> and modules</u>.</p>
</blockquote>
<p>Change paragraph 2:</p>
<blockquote>
<p>[<em>Note</em>: A <s>namespace name with external linkage</s><u><em>namespace-definition</em></u> is exported <s>if any of its <em>namespace-definition</em>⁠s is exported, or </s>if it contains any <em>export-declaration</em>⁠s ([module.interface]). A namespace is never attached to a <u>named </u>module<s>,</s> and never has <u>a name with </u>module linkage<s> even if it is not exported</s>. — <em>end note</em>] [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 3:</p>
<blockquote>
<p><s>The outermost declarative region of a translation unit</s><u>There</u> is a <s>namespace</s><u><em>global namespace</em> with no declaration</u>; see [basic.scope.namespace]. <u>The global namespace belongs to the global scope; it is not an unnamed namespace ([namespace.unnamed]). [<em>Note</em>: Lacking a declaration, it cannot be found by name lookup. — <em>end note</em>]</u></p>
</blockquote>
<h4 id="namespace.def">[namespace.def]</h4>
<p>Change paragraph 1:</p>
<blockquote>
<p>Every <em>namespace-definition</em> shall <s>appear at</s><u>inhabit a</u> namespace scope ([basic.scope.namespace]).</p>
</blockquote>
<p>Change paragraph 2:</p>
<blockquote>
<p>In a <em>named-namespace-definition</em><u> <em>D</em></u>, the <em>identifier</em> is the name of the namespace. <s>If t</s><u>T</u>he <em>identifier</em><s>, when</s><u>is</u> looked up<s> ([basic.lookup.unqual]), refers to a <em>namespace-name</em> (but not a <em>namespace-alias</em>) that was introduced</s><u> by searching for it</u> in the <u>scopes of the </u>namespace<u> <em>A</em></u> in which <s>the <em>named-namespace-definition</em></s><u><em>D</em></u> appears <s>or that was introduced in a member</s><u>and of every element</u> of the inline namespace set of <s>that namespace</s><u><em>A</em>. If the lookup finds a <em>namespace-definition</em> for a namespace <em>N</em></u>, <s>the <em>namespace-definition</em></s><u><em>D</em></u> <em>extends</em> <s>the previously-declared namespace</s><u><em>N</em>, and the target scope of <em>D</em> is the scope to which <em>N</em> belongs</u>. <s>Otherwise</s><u>If the lookup finds nothing</u>, the <em>identifier</em> is introduced as a <em>namespace-name</em> into <s>the declarative region in which the <em>named-namespace-definition</em> appears</s><u><em>A</em></u>.</p>
</blockquote>
<div class="del">
Remove paragraph 4 (whose example is adapted in [basic.scope.namespace]/1).
</div>
<p>Change paragraph 7:</p>
<blockquote>
<p>[…] Finally, looking up a name in the enclosing namespace via explicit qualification ([namespace.qual]) will include members of the inline namespace<s> brought in by the <em>using-directive</em></s> even if there are declarations of that name in the enclosing namespace.</p>
</blockquote>
<p>Change paragraph 8:</p>
<blockquote>
<p>These properties are transitive: if a namespace <code>N</code> contains an inline namespace <code>M</code>, which in turn contains an inline namespace <code>O</code>, then the members of <code>O</code> can be used as though they were members of <code>M</code> or <code>N</code>. The <em>inline namespace set</em> of <code>N</code> is the transitive closure of all inline namespaces in <code>N</code>. <s>The <em>enclosing namespace set</em> of <code>O</code> is the set of namespaces consisting of the innermost non-inline namespace enclosing an inline namespace <code>O</code>, together with any intervening inline namespaces.</s></p>
</blockquote>
<div class="del">
<h5>[namespace.memdef]</h5>
</div>
<p>Remove subclause, referring the stable name to [namespace.def]. Remove the cross-reference parenthetical in [namespace.def]/4 and update those in [temp.class.spec]/6 and [temp.expl.spec]/3 to refer to [dcl.meaning].</p>
<p>The examples in paragraphs 2 and 3 are moved to [dcl.meaning] and [class.friend]/11 respectively.</p>
<h4 id="namespace.alias">[namespace.alias]</h4>
<p>Change paragraph 2:</p>
<blockquote>
<p>The <em>identifier</em> in a <em>namespace-alias-definition</em> <s>is</s><u>becomes</u> a <s>synonym for the name of</s><u><em>namespace-alias</em> and denotes</u> the namespace denoted by the <em>qualified-namespace-specifier</em><s> and becomes a <em>namespace-alias</em></s>. [<em>Note</em>: When looking up a <em>namespace-name</em> in a <em>namespace-alias-definition</em>, only namespace names are considered, see [basic.lookup.udir]. — <em>end note</em>]</p>
</blockquote>
<div class="del">
Remove paragraph 3 (whose example is adapted in [basic.scope.scope]).
</div>
<h4 id="namespace.udir">[namespace.udir]</h4>
<p>Change paragraph 2:</p>
<blockquote>
<p><u>[<em>Note</em>: </u>A <em>using-directive</em> <s>specifies that</s><u>makes</u> the names in the nominated namespace <s>can be used</s><u>usable</u> in the scope in which the <em>using-directive</em> appears after the <em>using-directive</em><u> ([basic.lookup.unqual], [namespace.qual])</u>. During unqualified name lookup<s> ([basic.lookup.unqual])</s>, the names appear as if they were declared in the nearest enclosing namespace which contains both the <em>using-directive</em> and the nominated namespace. <s>[<em>Note</em>: In this context, “contains” means “contains directly or indirectly”.</s> — <em>end note</em>]</p>
</blockquote>
<p>Change paragraph 3:</p>
<blockquote>
<p><u>[<em>Note</em>: </u>A <em>using-directive</em> does not <s>add any members to the declarative region in which it appears</s><u>introduce any names</u>.<u> — <em>end note</em>]</u> [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 4:</p>
<blockquote>
<p><s>For unqualified lookup ([basic.lookup.unqual]), the</s><u>[<em>Note</em>: A</u> <em>using-directive</em> is transitive: if a scope contains a <em>using-directive</em> that nominates a <s>second </s>namespace that itself contains <em>using-directive</em>⁠s, the <s>effect is as if the</s><u>namespaces nominated by those</u> <em>using-directive</em>⁠s <s>from the second namespace</s><u>are</u> also <s>appeared in the first</s><u>eligible to be considered</u>. <s>[<em>Note</em>: For qualified lookup, see [namespace.qual].</s> — <em>end note</em>] [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 5:</p>
<blockquote>
<p><s>If</s><u>[<em>Note</em>: Declarations in</u> a namespace <s>is extended ([namespace.def])</s><u>that appear</u> after a <em>using-directive</em> for that namespace <s>is given, the additional members of the extended namespace and the members of namespaces nominated by</s><u>can be found through that</u> <em>using-directive</em><s>⁠s in the extending <em>namespace-definition</em> can be used after the extending <em>namespace-definition</em></s><u> after they appear</u>.<u> — <em>end note</em>]</u></p>
</blockquote>
<p>Change paragraph 7:</p>
<blockquote>
<p><s>During overload resolution, all functions from the transitive search are considered for argument matching. The set of declarations found by the transitive search is unordered.</s> [<em>Note</em>: <s>In particular, t</s><u>T</u>he order in which namespaces <s>we</s><u>a</u>re considered and the relationships among the namespaces implied by the <em>using-directive</em>⁠s do not <s>cause preference to be given to any of the declarations found by the search</s><u>affect overload resolution</u>.<s> — <em>end note</em>]</s> <s>An ambiguity exists if the best match finds two functions with</s><u>Neither is any function excluded because another has</u> the same signature, even if one is in a namespace reachable through <em>using-directive</em>⁠s in the namespace of the other.<sup>[…]</sup><u> — <em>end note</em>]</u> [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<h4 id="namespace.udecl">[namespace.udecl]</h4>
<p>Change and split paragraph 1:</p>
<blockquote>
<p><u>The component names of a <em>using-declarator</em> are those of its <em>nested-name-specifier</em> and <em>unqualified-id</em>.</u> Each <em>using-declarator</em> in a <em>using-declaration</em><sup>[…]</sup> <s>introduces a set of declarations into the declarative region in which the <em>using-declaration</em> appears. The</s><u>names the</u> set of declarations<s> introduced by the <em>using-declarator</em> is</s> found by <s>performing qualified name </s>lookup ([basic.lookup.qual]<s>, [class.member.lookup]</s>) for <s>the name in </s>the <em>using-declarator</em>, <s>excluding</s><u>except that class and enumeration declarations that would be discarded are merely ignored when checking for ambiguity ([basic.lookup]), conversion function templates with a dependent return type are ignored, and certain</u> functions <s>that </s>are hidden as described below.<!-- remote --> <u>If the terminal name of the <em>using-declarator</em> is dependent ([temp.dep.type]), the <em>using-declarator</em> is considered to name a constructor if and only if the <em>nested-name-specifier</em> has a terminal name that is the same as the <em>unqualified-id</em>. If the lookup in any instantiation finds that a <em>using-declarator</em> that is not considered to name a constructor does do so, or that a <em>using-declarator</em> that is considered to name a constructor does not, the program is ill-formed.</u></p>
</blockquote>
<blockquote>
<p><s>If the <em>using-declarator</em> does not name a constructor, the <em>unqualified-id</em> is declared in the declarative region in which the <em>using-declaration</em> appears as a synonym for each declaration introduced by the <em>using-declarator</em>. [<em>Note</em>: Only the specified name is so declared; specifying an enumeration name in a <em>using-declaration</em> does not declare its enumerators in the <em>using-declaration</em>’s declarative region. — <em>end note</em>]</s> If the <em>using-declarator</em> names a constructor, it declares that the class <em>inherits</em> the <u>named </u>set of constructor declarations<s> introduced by the <em>using-declarator</em></s> from the nominated base class. <u>[<em>Note</em>: Otherwise, the <em>unqualified-id</em> in the <em>using-declarator</em> is bound to the <em>using-declarator</em>, which is replaced during name lookup with the declarations it names ([basic.lookup]). If such a declaration is of an enumeration, the names of its enumerators are not bound. For the keyword <code>typename</code>, see [temp.res]. — <em>end note</em>]</u></p>
</blockquote>
<div class="del">
Remove paragraph 2 (part of whose example is merged into another below).
</div>
<p>Change paragraph 3, combining its latter two examples with that from /2 (in the given order and with changes as marked):</p>
<blockquote>
<p>In a <em>using-declaration</em> used as a <em>member-declaration</em>, each <em>using-declarator</em> shall either name an enumerator or have a <em>nested-name-specifier</em> naming a base class of the <u>current </u>class<s> being defined</s>. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>] If a <em>using-declarator</em> names a constructor, its <em>nested-name-specifier</em> shall name a direct base class of the <u>current </u>class<s> being defined</s>. <u>If the immediate (class) scope is associated with a class template, it shall derive from the specified base class or have at least one dependent base class.</u> <s>[<em>Example</em>:</s></p>
<p><s>[…]</s></p>
<s>— <em>end example</em>]</s> [<em>Example</em>:
<pre class="cpp">
struct B {
  void f(char);
<s>  void g(char);
</s>  enum E { e };
  union { int x; };
};

<s>struct D : B {
  using B::f;
  void f(int) { f('c'); }       // calls B::f(char)
  void g(int) { g('c'); }       // recursively calls D::g(int)
};
</s>
<s>class</s><u>struct</u> C {
  int <s>g</s><u>f</u>();
};

<s>class</s><u>struct</u> D<s>2</s> : <s>public </s>B {
  using B::f;                   // OK: B is a base of D<s>2</s>
  using B::e;                   // OK: e is an enumerator of base B
  using B::x;                   // OK: x is a union member of base B
  using C::<s>g</s><u>f</u>;                   // error: C isn't a base of D<s>2</s>
<u>  void f(int) { f('c'); }       // calls B::f(char)
  void g(int) { g('c'); }       // recursively calls D::g(int)
</u>};

template &lt;typename... bases&gt;
struct X : bases... {
  using bases::<s>g</s><u>f</u>...;
};

X&lt;B, <s>D</s><u>C</u>&gt; x;                      // OK: B::<s>g</s><u>f</u> and <s>D</s><u>C</u>::<s>g</s><u>f</u> <s>introduced</s><u>named</u>
</pre>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 4:</p>
<blockquote>
<p>[<em>Note</em>: Since destructors do not have names, a <em>using-declaration</em> cannot refer to a destructor for a base class. <s>Since specializations of member templates for conversion functions are not found by name lookup, they are not considered when a <em>using-declaration</em> specifies a conversion function ([temp.mem]).</s> — <em>end note</em>] If a constructor or assignment operator brought from a base class into a derived class has the signature of a copy/move constructor or assignment operator for the derived class ([class.copy.ctor], [class.copy.assign]), the <em>using-declaration</em> does not by itself suppress the implicit declaration of the derived class member; the member from the base class is hidden or overridden by the implicitly-declared copy/move constructor or assignment operator of the derived class, as described below.</p>
</blockquote>
<div class="del">
<p>Remove paragraph 8.</p>
Replace paragraph 9:
</div>
<div class="ins">
<blockquote>
<p>If a declaration is named by two <em>using-declarator</em>⁠s that inhabit the same class scope, the program is ill-formed.</p>
</blockquote>
</div>
<p>Change paragraph 10:</p>
<blockquote>
<p>[<em>Note</em>: <s>For a</s><u>A</u> <em>using-declarat<s>ion</s><u>or</u></em> whose <em>nested-name-specifier</em> names a namespace<s>, members</s><u> does not name declarations</u> added to the namespace after <s>the <em>using-declaration</em> are not in the set of introduced declarations, so they are not considered when a use of the name is made</s><u>it</u>. Thus, additional overloads added after the <em>using-declaration</em> are ignored, but default function arguments ([dcl.fct.default]), default template arguments ([temp.param]), and template specializations ([temp.class.spec], [temp.expl.spec]) are considered. — <em>end note</em>] [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<div class="del">
Remove paragraph 11.
</div>
<p>Change paragraph 12:</p>
<blockquote>
<s>Since a <em>using-declaration</em> is a declaration, the restrictions on declarations of the same name in the same declarative region ([basic.scope]) also apply to <em>using-declaration</em>⁠s.</s> <u>If a declaration named by a <em>using-declaration</em> that inhabits the target scope of another declaration potentially conflicts with it ([basic.scope.scope]) and either is reachable from the other, the program is ill-formed. If two declarations named by <em>using-declaration</em>⁠s that inhabit the same scope potentially conflict, either is reachable from the other, and they do not both declare functions or function templates, the program is ill-formed. [<em>Note</em>: Overload resolution may not be able to distinguish between conflicting function declarations. — <em>end note</em>]</u> [<em>Example</em>:
<pre class="cpp">
namespace A {
  int x;
<u>  int f(int);
  int g;
  void h();
</u>}

namespace B {
  int i;
  struct g { };
  struct x { };
  void f(int);
  void f(double);
  void g(char);     // OK: hides struct g
}

void func() {
  int i;
  using B::i;       // error: <s>i declared twice</s><u>conflicts</u>
  void f(char);
  using B::f;       // OK: each f is a function
<u>  using A::f;       // OK, but interferes with B::f(int)
  f(1);             // error: ambiguous
  static_cast&lt;int(*)(int)&gt;(f)(1);  // OK: calls A::f
</u>  f(3.5);           // calls B::f(double)
  using B::g;
  g('a');           // calls B::g(char)
  struct g g1;      // g1 has class type B::g
<u>  using A::g;       // error: conflicts with B::g
  void h();
  using A::h;       // error: conflicts
</u>  using B::x;
  using A::x;       // OK: hides struct B::x
  x = 99;           // assigns to A::x
  struct x x1;      // x1 has class type B::x
}
</pre>
<p>— <em>end example</em>]</p>
</blockquote>
<div class="del">
Remove paragraph 13 (whose example is merged into the above).
</div>
<p>Change paragraph 14:</p>
<blockquote>
<p><s>When</s><u>The set of declarations named by</u> a <em>using-declarator</em> <s>brings declarations from a base class into a derived class,</s><u>that inhabits a class <code>C</code> does not include</u> member functions and member function templates <s>in the derived</s><u>of a base</u> class <s>override and/or hide member functions and member function templates with the same name, parameter-type-list ([dcl.fct]), trailing <em>requires-clause</em> (if any), cv-qualification, and <em>ref-qualifier</em> (if any), in a base class</s><u>that correspond to</u> (<s>rather than</s><u>and thus would</u> conflict<s>ing</s><u> with</u>)<u> a declaration of a function or function template in <code>C</code></u>. <s>Such hidden or overridden declarations are excluded from the set of declarations introduced by the <em>using-declarator</em>.</s> [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 15:</p>
<blockquote>
<p>[<em>Note</em>: For the purpose of forming a set of candidates during overload resolution, the functions <s>that are introduced</s><u>named</u> by a <em>using-declaration</em> in<s>to</s> a derived class are treated as though they were <u>direct </u>members of the derived class<s> ([class.member.lookup])</s>. In particular, the implicit object parameter is treated as if it were a reference to the derived class rather than to the base class ([over.match.funcs]). This has no effect on the type of the function, and in all other respects the function remains <s>a member</s><u>part</u> of the base class. — <em>end note</em>]</p>
</blockquote>
<p>Change paragraph 16:</p>
<blockquote>
<p>Constructors that are <s>introduced</s><u>named</u> by a <em>using-declaration</em> are treated as though they were constructors of the derived class when looking up the constructors of the derived class ([class.qual]) or forming a set of overload candidates ([over.match.ctor], [over.match.copy], [over.match.list]).<!-- remote --> [<em>Note</em>: If such a constructor is selected to perform the initialization of an object of class type, all subobjects other than the base class from which the constructor originated are implicitly initialized ([class.inhctor.init]). A constructor of a derived class is sometimes preferred to a constructor of a base class if they would otherwise be ambiguous ([over.match.best]). — <em>end note</em>]</p>
</blockquote>
<p>Change paragraph 17:</p>
<blockquote>
<p>In a <em>using-declarator</em> that does not name a constructor, <s>all members of the set of introduced</s><u>every</u> declaration<s>s</s><u> named</u> shall be accessible. In a <em>using-declarator</em> that names a constructor, no access check is performed. <s>In particular, if a derived class uses a <em>using-declarator</em> to access a member of a base class, the member name shall be accessible. If the name is that of an overloaded member function, then all functions named shall be accessible.</s> <s>The base class members mentioned by a <em>using-declarator</em> shall be visible in the scope of at least one of the direct base classes of the class where the <em>using-declarator</em> is specified.</s></p>
</blockquote>
<p>Change paragraph 19:</p>
<blockquote>
<p>A <s>synonym created by a </s><em>using-declaration</em> has the usual accessibility for a <em>member-declaration</em>. <s>A</s><u>Base-class constructors considered because of a</u> <em>using-declarator</em><s> that names a constructor does not create a synonym; instead, the additional constructors</s> are accessible if they would be accessible when used to construct an object of the <s>corresponding </s>base class<s>, and</s><u>;</u> the accessibility of the <em>using-declaration</em> is ignored. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<div class="del">
Remove paragraph 20.
</div>
<h3 id="dcl.link">[dcl.link]</h3>
<p>Change paragraph 1:</p>
<blockquote>
<p>All <s>function types, </s>function<u>s</u><s> names with external linkage,</s> and variable<u>s whose</u> names <s>with</s><u>have</u> external linkage<u> and all function types</u> have a <em>language linkage</em>. [<em>Note</em>: Some of the properties associated with an entity with language linkage are specific to each implementation and are not described here. For example, a particular language linkage may be associated with a particular form of representing names of objects and functions with external linkage, or with a particular calling convention, etc. — <em>end note</em>] The default language linkage of all function types, function<u>s</u><s> names</s>, and variable<u>s</u><s> names</s> is C++ language linkage. Two function types with different language linkages are distinct types even if they are otherwise identical.</p>
</blockquote>
<p>Change paragraph 3:</p>
<blockquote>
<p>Every implementation shall provide for linkage to <s>functions written in </s>the C programming language, <code>&quot;C&quot;</code>, and <s>linkage to </s>C++<s> functions</s>, <code>&quot;C++&quot;</code>. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 5:</p>
<blockquote>
<p>Linkage specifications nest. When linkage specifications nest, the innermost one determines the language linkage. <u>[<em>Note</em>: </u>A linkage specification does not establish a scope.<u> — <em>end note</em>]</u> A <em>linkage-specification</em> shall <s>occur only in</s><u>inhabit a</u> namespace scope<s> ([basic.scope])</s>. In a <em>linkage-specification</em>, the specified language linkage applies to the function types of all function declarators<s>,</s><u> and to all</u> function<u>s</u><s> names with external linkage,</s> and variable<u>s</u><s> names with external linkage declared within the <em>linkage-specification</em></s>. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>] A C language linkage is ignored in determining the language linkage of <s>the names of </s>class members and the function type of class member functions. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 6:</p>
<blockquote>
<p>If two declarations <s>declare functions with the same name and parameter-type-list ([dcl.fct]) to be members of the same namespace or declare objects with the same name to be members of the same namespace and the declarations</s><u>of an entity</u> give <s>the names</s><u>it</u> different language linkages, the program is ill-formed; no diagnostic is required if <s>the</s><u>neither</u> declaration<s>s appear in different translation units</s><u> is reachable from the other</u>. <s>Except for functions with C++ linkage, a function declaration without a linkage specification shall not precede the first linkage specification for that function.</s> A <s>function can be declared</s><u>redeclaration of an entity</u> without a linkage specification <s>after an explicit linkage specification has been seen; the linkage explicitly specified in the earlier declaration is not affected by such a function declaration</s><u>inherits the language linkage of the entity and (if applicable) its type</u>.</p>
</blockquote>
<p>Change paragraph 7:</p>
<blockquote>
<p><s>At most one function with a particular name can have C language linkage.</s> Two declarations <s>for</s><u>declare the same entity if they (re)introduce the same name, one declares</u> a function<u> or variable</u> with C language linkage<u>, and the other declares such an entity or a variable that belongs to the global scope</u><s>with the same function name (ignoring the namespace names that qualify it) that appear in different namespace scopes refer to the same function</s>. <s>Two declarations for a variable with C language linkage with the same name (ignoring the namespace names that qualify it) that appear in different namespace scopes refer to the same variable. An entity with C language linkage shall not be declared with the same name as a variable in global scope, unless both declarations denote the same entity; no diagnostic is required if the declarations appear in different translation units. A variable with C language linkage shall not be declared with the same name as a function with C language linkage (ignoring the namespace names that qualify the respective names); no diagnostic is required if the declarations appear in different translation units. [<em>Note</em>: Only one definition for an entity with a given name with C language linkage may appear in the program (see [basic.def.odr]); this implies that such an entity must not be defined in more than one namespace scope. — <em>end note</em>]</s> [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<h3 id="dcl.attr.nodiscard">[dcl.attr.nodiscard]</h3>
<p>Change paragraph 2:</p>
<blockquote>
<p>A<u>n</u> <s>name or </s>entity declared without the <code>nodiscard</code> attribute can later be redeclared with the attribute and vice-versa. […]</p>
</blockquote>
<h2 id="module">[module]</h2>
<h3 id="module.interface">[module.interface]</h3>
<p>Change paragraph 1:</p>
<blockquote>
<p>An <em>export-declaration</em> shall <s>appear only at</s><u>inhabit a</u> namespace scope and <s>only</s><u>appear</u> in the purview of a module interface unit. An <em>export-declaration</em> shall not appear directly or indirectly within an unnamed namespace or a <em>private-module-fragment</em>. An <em>export-declaration</em> has the declarative effects of its <em>declaration</em>, <em>declaration-seq</em> (if any), or <em>module-import-declaration</em>. <s>An <em>export-declaration</em> does not establish a scope and its</s><u>The</u> <em>declaration</em> or <em>declaration-seq</em><u> of an <em>export-declaration</em></u> shall not contain an <em>export-declaration</em> or <em>module-import-declaration</em>. <u>[<em>Note</em>: An <em>export-declaration</em> does not establish a scope. — <em>end note</em>]</u></p>
</blockquote>
<p>Change bullet (2.1):</p>
<blockquote>
<p><s>a namespace-scope declaration </s>declared within an <em>export-declaration</em><u> and inhabits a namespace scope</u>, or</p>
</blockquote>
<p>Change paragraph 6:</p>
<blockquote>
<p>A redeclaration of <s>an exported declaration of </s>an entity<u> or <em>typedef-name</em> <em>X</em></u> is implicitly exported<u> if <em>X</em> was introduced by an exported declaration; otherwise it shall not be exported</u>. <s>An exported redeclaration of a non-exported declaration of an entity is ill-formed.</s> [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 7:</p>
<blockquote>
<p><s>A name is <em>exported</em> by a module if it is introduced or redeclared by an exported declaration in the purview of that module.</s> [<em>Note</em>: <u>Names introduced by e</u><s>E</s>xported <s>names</s><u>declarations</u> have either external linkage or no linkage; see [basic.link]. Namespace-scope <s>names</s><u>declarations</u> exported by a module <s>are visible to</s><u>can be found by</u> name lookup in any translation unit importing that module<s>; see </s><u> (</u>[basic.<s>scope.namespace</s><u>lookup</u>]<u>)</u>. Class and enumeration member names <s>are visible to</s><u>can be found by</u> name lookup in any context in which a definition of the type is reachable. — <em>end note</em>] [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<div class="del">
Remove paragraph 8.
</div>
<h3 id="module.import">[module.import]</h3>
<p>Change paragraph 1:</p>
<blockquote>
<p>A <em>module-import-declaration</em> shall <s>only appear at</s><u>inhabit the</u> global<s> namespace</s> scope. In a module unit, all <em>module-import-declaration</em>⁠s and <em>export-declaration</em>⁠s exporting <em>module-import-declaration</em>⁠s shall <s>precede</s><u>appear before</u> all other <em>declaration</em>⁠s in the <em>declaration-seq</em> of the <em>translation-unit</em> and of the <em>private-module-fragment</em> (if any). The optional <em>attribute-specifier-seq</em> appertains to the <em>module-import-declaration</em>.</p>
</blockquote>
<p>Change paragraph 2:</p>
<blockquote>
<p>A <em>module-import-declaration</em> <em>imports</em> a set of translation units determined as described below. [<em>Note</em>: Namespace-scope <s>names</s><u>declarations</u> exported by the imported translation units <s>become visible</s><u>can be found by name lookup</u> ([basic.<s>scope.namespace</s><u>lookup</u>]) in the importing translation unit and declarations within the imported translation units become reachable ([module.reach]) in the importing translation unit after the import declaration. — <em>end note</em>]</p>
</blockquote>
<p>Change the footnote in paragraph 7:</p>
<blockquote>
<p>This is consistent with the <u>lookup </u>rules for <s>visibility of </s>imported names ([basic.<s>scope.namespace</s><u>lookup</u>]).</p>
</blockquote>
<h3 id="module.global.frag">[module.global.frag]</h3>
<p>Change bullet (3.3):</p>
<blockquote>
<p><em>S</em> contains a<s>n expression</s><u> dependent call</u> <code>E</code><s> of the form</s></p>
<blockquote>
<p><s><em>postfix-expression</em> <code>(</code> <em>expression-list</em><sub><em>opt</em></sub> <code>)</code></s></p>
</blockquote>
<p><s>whose <em>postfix-expression</em> denotes a dependent name, or for an operator expression whose operator denotes a dependent name,</s> and <em>D</em> is found by name lookup for the <s>corresponding</s><u>dependent</u> name in an expression synthesized from <code>E</code> by replacing each type-dependent argument or operand with a value of a placeholder type with no associated namespaces or entities, or</p>
</blockquote>
<p>Change bullet (3.7):</p>
<blockquote>
<p><em>D</em> redeclares the entity declared by <em>M</em> or <em>M</em> redeclares the entity declared by <em>D</em>, and <em>D</em> <s>is </s>neither<u> is</u> a friend declaration nor <u>inhabits </u>a block<s>-</s><u> </u>scope<s> declaration</s>, or</p>
</blockquote>
<h3 id="module.context">[module.context]</h3>
<p>Change paragraph 1:</p>
<blockquote>
<p>The <em>instantiation context</em> is a set of points within the program that determines which <s>names</s><u>declarations</u> are <s>visible to</s><u>found by</u> argument-dependent name lookup ([basic.lookup.argdep]) and which <s>declarations </s>are reachable ([module.reach]) in the context of a particular declaration or template instantiation.</p>
</blockquote>
<h3 id="module.reach">[module.reach]</h3>
<p>Change paragraph 1:</p>
<blockquote>
<p>A translation unit <em>U</em> is <em>necessarily reachable</em> from a point <em>P</em> if <em>U</em> is a module interface unit on which the translation unit containing <em>P</em> has an interface dependency, or the translation unit containing <em>P</em> imports <em>U</em>, in either case prior to <em>P</em> ([module.import]). [<em>Note</em>: While module interface units are reachable even when they are only transitively imported via a non-exported import declaration, namespace-scope names from such module interface units are not <s>visible to</s><u>found by</u> name lookup ([basic.<s>scope.namespace</s><u>lookup</u>]). — <em>end note</em>]</p>
</blockquote>
<p>Change paragraph 3:</p>
<blockquote>
<p>A declaration <em>D</em> is <em>reachable<u> from</u></em> <s>if, for any</s><u>a</u> point <em>P</em> <s>in the instantiation context ([module.context]),</s><u>if</u></p>
<ol style="list-style-type: decimal">
<li><em>D</em> appears prior to <em>P</em> in the same translation unit, or</li>
<li><em>D</em> is not discarded ([module.global.frag]), appears in a translation unit that is reachable from <em>P</em>, and does not appear within a <em>private-module-fragment</em>.</li>
</ol>
<p><u>A declaration is <em>reachable</em> if it is reachable from any point in the instantiation context ([module.context]).</u> [<em>Note</em>: Whether a declaration is exported has no bearing on whether it is reachable. — <em>end note</em>]</p>
</blockquote>
<p>Change paragraph 4:</p>
<blockquote>
<p>The accumulated properties of all reachable declarations of an entity within a context determine the behavior of the entity within that context. [<em>Note</em>: These reachable semantic properties include type completeness, type definitions, initializers, default arguments of functions or template declarations, attributes, <s>visibility of class or enumeration member </s>names <s>to ordinary lookup</s><u>bound</u>, etc. Since default arguments are evaluated in the context of the call expression, the reachable semantic properties of the corresponding parameter types apply in that context. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>] — <em>end note</em>]</p>
</blockquote>
<p>Change paragraph 5:</p>
<blockquote>
<p>[<em>Note</em>: <u>Declarations of a</u><s>A</s>n entity can <s>have</s><u>be</u> reachable<s> declarations</s> even <s>if it is not visible to</s><u>where they can be found by</u> name lookup. — <em>end note</em>] [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<h2 id="class">[class]</h2>
<h3 id="class.pre">[class.pre]</h3>
<p>Change paragraph 1:</p>
<blockquote>
<p>[…]</p>
<p><u>The <em>identifier</em> in the <em>class-head-name</em> is not looked up.</u> A class declaration where the <em>class-name</em> in the <em>class-head-name</em> is a <em>simple-template-id</em> shall be an explicit specialization ([temp.expl.spec]) or a partial specialization ([temp.class.spec]). A <em>class-specifier</em> whose <em>class-head</em> omits the <em>class-head-name</em> defines an unnamed class. [<em>Note</em>: An unnamed class thus can’t be <code>final</code>. — <em>end note</em>]</p>
</blockquote>
<p>Change paragraph 2:</p>
<blockquote>
<p><s>A</s><u>If the</u> <em>class-name</em> is <s>inserted into the scope in which it is declared immediately after the <em>class-name</em> is seen</s><u>an <em>identifier</em>, the <em>class-specifier</em> introduces it</u>. The <em>class-name</em> is also <s>inserted into</s><u>bound in</u> the scope of the class<u> (template)</u> itself; this is known as the <em>injected-class-name</em>. […]</p>
</blockquote>
<p>Change paragraph 3:</p>
<blockquote>
<p>If a <em>class-head-name</em> contains a <em>nested-name-specifier</em>, the <em>class-specifier</em> shall <s>refer to a class that was previously declared directly in</s><u>not inhabit a class scope; let <em>E</em> be</u> the class<u>, class template,</u> or namespace to which the <em>nested-name-specifier</em> refers<s>, or in an element of the inline namespace set ([namespace.def]) of that namespace (i.e., not merely inherited or introduced by a <em>using-declaration</em>), and the <em>class-specifier</em> shall appear in a namespace enclosing the previous declaration</s>. <s>In such cases, the <em>nested-name-specifier</em> of the <em>class-head-name</em> of the definition shall not begin with a <em>decltype-specifier</em>.</s> <u>Otherwise, if its <em>class-name</em> is a <em>simple-template-id</em>, let <em>E</em> be the entity associated with its immediate scope. In either case, the <em>class-specifier</em> shall (ignoring any template argument list in the <em>class-name</em>) correspond to one or more declarations nominable in <em>E</em> ([basic.scope.scope]); they shall all have the same target scope, and the target scope of the <em>class-specifier</em> is that scope.</u></p>
</blockquote>
<h3 id="class.prop">[class.prop]</h3>
<p>Change bullet (3.7.1):</p>
<blockquote>
<p>If <code>X</code> is a non-union class type with no <s>(possibly inherited ([class.derived])) </s>non-static data members, the set <em>M</em>(<code>X</code>) is empty.</p>
</blockquote>
<h3 id="class.name">[class.name]</h3>
<p>Change paragraph 2:</p>
<blockquote>
<s>A class declaration introduces the class name into the scope where it is declared and hides any class, variable, function, or other declaration of that name in an enclosing scope ([basic.scope]).</s> <s>If</s><u>[<em>Note</em>: It may be necessary to use an <em>elaborated-type-specifier</em> to refer to</u> a class <s>name is declared in</s><u>that belongs to</u> a scope <s>where</s><u>to which</u> a variable, function, or enumerator of the same name <s>is </s>also <s>declared, then when both declarations are in scope, the class can be referred to only using an <em>elaborated-type-specifier</em></s><u>belongs</u> ([basic.lookup.elab]). [<em>Example</em>:
<pre class="cpp">
struct stat {
  // ...
};

stat gstat;                     // use plain stat to define variable

int stat(struct stat*);         // <s>redeclare </s>stat <s>as</s><u>now also names a</u> function

void f() {
  struct stat* ps;              // struct prefix needed to name struct stat
  stat(ps);                     // call stat<s>()</s><u> function</u>
}
</pre>
<p>— <em>end example</em>]<u> — <em>end note</em>] [<em>Note</em>: </u>A<u>n <em>elaborated-type-specifier</em></u> <s><em>declaration</em> consisting solely of <em>class-key</em> <em>identifier</em><code>;</code> is either a redeclaration of the name in the current scope or a forward declaration of the</s><u>may also be used to declare an</u> identifier as a class name. <s>It introduces the class name into the current scope.</s> [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]<u> — <em>end note</em>]</u> [<em>Note</em>: Such declarations allow definition of classes that refer to each other. [<em>Example</em>:</p>
<p>[…]</p>
<p>Declaration of friends is described in [class.friend], operator functions in [over.oper]. — <em>end example</em>] — <em>end note</em>]</p>
</blockquote>
<h3 id="class.mem">[class.mem]</h3>
<p>Change paragraph 1:</p>
<blockquote>
<p>[…] A <em>direct member</em> of a class <code>X</code> is a member of <code>X</code> that was first declared within the <em>member-specification</em> of <code>X</code>, including anonymous union <s>objects</s><u>members</u> ([class.union.anon]) and direct members thereof. […]</p>
</blockquote>
<p>Change paragraph 6:</p>
<blockquote>
<p>A <em>complete-class context</em> of a class<u> (template)</u> is a</p>
<ol style="list-style-type: decimal">
<li>function body ([dcl.fct.def.general]),</li>
<li>default argument ([dcl.fct.default]),</li>
<li><u>default template argument ([temp.param]), or</u></li>
<li><em>noexcept-specifier</em> ([except.spec]), or</li>
<li>default member initializer</li>
</ol>
<p>within the <em>member-specification</em> of the class<u> or class template</u>. [<em>Note</em>: […] — <em>end note</em>][…]</p>
</blockquote>
<h4 id="class.mfct">[class.mfct]</h4>
<p>Change paragraph 1:</p>
<blockquote>
<p><s>A</s><u>If a</u> member function <s>may be</s><u>is attached to the global module and is</u> defined ([dcl.fct.def]) in its class definition, <s>in which case </s>it is <s>an </s>inline ([dcl.inline])<s> member function if it is attached to the global module, or it may be defined outside of its class definition if it has already been declared but not defined in its class definition</s>. [<em>Note</em>: A member function is also inline if it is declared <code>inline</code>, <code>constexpr</code>, or <code>consteval</code>. — <em>end note</em>]</p>
</blockquote>
<p>Change paragraph 2:</p>
<blockquote>
<p><s>A member function definition that appears outside of the class definition shall appear in a namespace scope enclosing the class definition.</s> <s>Except for</s><u>A</u> member function <s>definitions</s><u>declaration</u> that appear<u>s</u> outside of a class definition<s>, and except for explicit specializations of member functions of class templates and member function templates ([temp.spec]) appearing outside of the class definition, a member function</s> shall<s> not</s> be <s>redeclared</s><u>a definition, an explicit specialization, or an explicit instantiation ([temp.expl.spec], [temp.explicit])</u>. <s>[<em>Note</em>: There can be at most one definition of a non-inline member function in a program. There may be more than one inline member function definition in a program. See [basic.def.odr] and [dcl.inline]. — <em>end note</em>]</s> [<em>Note</em>: […] — <em>end note</em>]</p>
</blockquote>
<div class="del">
<p>Remove paragraph 3 except for its example.</p>
Remove paragraphs 4 and 5.
</div>
<h4 id="class.mfct.non-static">[class.mfct.non-static]</h4>
<p>Change paragraph 3:</p>
<blockquote>
<p>When an <em>id-expression</em> ([expr.prim.id]) that is not part of a class member access syntax ([expr.ref]) and not used to form a pointer to member ([expr.unary.op]) is used <s>in a member of</s><u>where the current</u> class <u>is </u><code>X</code><s> in a context where <code>this</code> can be used</s> ([expr.prim.this]), if name lookup ([basic.lookup]) resolves the name in the <em>id-expression</em> to a non-static non-type member of some class <code>C</code>, and if either the <em>id-expression</em> is potentially evaluated or <code>C</code> is <code>X</code> or a base class of <code>X</code>, the <em>id-expression</em> is transformed into a class member access expression ([expr.ref]) using <code>(*this)</code><s> ([class.this])</s> as the <em>postfix-expression</em> to the left of the <code>.</code> operator. […]</p>
</blockquote>
<p>Change and combine paragraphs 4 and 5:</p>
<blockquote>
<p><u>[<em>Note</em>: </u>A non-static member function may be declared <s><code>const</code>, <code>volatile</code>, or <code>const</code> <code>volatile</code>. These</s><u>with</u> <em>cv-qualifier</em>⁠s<u>, which</u> affect the type of the <code>this</code> pointer ([<s>class</s><u>expr.prim</u>.this])<s>. They also affect the function type ([dcl.fct]) of the member function; a member function declared <code>const</code> is a <em>const member function</em>, a member function declared <code>volatile</code> is a <em>volatile member function</em> and a member function declared <code>const</code> <code>volatile</code> is a <em>const volatile member function</em>. [<em>Example</em>:</s></p>
<p><s>[…]</s></p>
<p><s><code>X::g</code> is a const member function and <code>X::h</code> is a const volatile member function. — <em>end example</em>] A non-static member function may be declared with</s><u>and/or</u> a <em>ref-qualifier</em> ([dcl.fct])<s>; see</s><u>; both affect overload resolution</u> <u>(</u>[over.match.funcs]<u>)</u>.<u> — <em>end note</em>]</u></p>
</blockquote>
<div class="del">
<h4>[class.this]</h4>
</div>
<p>Remove subclause, referring the stable name to [expr.prim.this].</p>
<h4 id="class.ctor">[class.ctor]</h4>
<p>Change paragraph 2:</p>
<blockquote>
<p>A constructor is used to initialize objects of its class type. <u>[<em>Note</em>: </u>Because constructors do not have names, they are never found during <u>unqualified </u>name lookup; however an explicit type conversion using the functional notation ([expr.type.conv]) will cause a constructor to be called to initialize an object. <s>[<em>Note</em>: </s>The syntax looks like an explicit call of the constructor. — <em>end note</em>] [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>] [<em>Note</em>: For initialization of objects of class type see [class.init]. — <em>end note</em>]</p>
</blockquote>
<h4 id="class.dtor">[class.dtor]</h4>
<p>Change paragraph 1:</p>
<blockquote>
<p>A <s><em>prospective destructor</em> is introduced by a </s>declaration whose <em>declarator<u>-id</u></em> <s>is</s><u>has an <em>unqualified-id</em> that begins with a <code>~</code> declares a <em>prospective destructor</em>; its <em>declarator</em> shall be</u> a function declarator ([dcl.fct]) of the form</p>
<p>[…]</p>
</blockquote>
<p>Change paragraph 12:</p>
<blockquote>
<p>A prospective destructor can be declared <code>virtual</code> ([class.virtual]) or pure <code>virtual</code> ([class.abstract]). If the destructor of a class is virtual and any objects of that class or any derived class are created in the program, the destructor shall be defined. <s>If a class has a base class with a virtual destructor, its destructor (whether user- or implicitly-declared) is virtual.</s></p>
</blockquote>
<h4 id="class.conv">[class.conv]</h4>
<div class="del">
Remove paragraph 5 (adapted in [class.conv.fct]).
</div>
<h5 id="class.conv.fct">[class.conv.fct]</h5>
<p>Change paragraph 1:</p>
<blockquote>
<p>A member function of a class <code>X</code> <s>having no parameters </s>with a name of the form</p>
<blockquote>
<p><em>conversion-function-id</em>:</p>
<blockquote>
<p><code>operator</code> <em>conversion-type-id</em></p>
</blockquote>
<p><em>conversion-type-id</em>:</p>
<blockquote>
<p><em>type-specifier-seq</em> <em>conversion-declarator</em><sub><em>opt</em></sub></p>
</blockquote>
<p><em>conversion-declarator</em>:</p>
<blockquote>
<p><em>ptr-operator</em> <em>conversion-declarator</em><sub><em>opt</em></sub></p>
</blockquote>
</blockquote>
<p><u>shall have no parameters and </u>specifies a conversion from <code>X</code> to the type specified by the <em>conversion-type-id</em><u>, interpreted as a <em>type-id</em> ([dcl.name])</u>. […]</p>
</blockquote>
<div class="del">
Replace paragraph 4 with [class.conv]/5, with changes as marked:
</div>
<div class="ins">
<blockquote>
<p><s>User-defined conversions are used implicitly only if they are unambiguous.</s> <u>[<em>Note</em>: </u>A conversion function in a derived class <s>does not </s>hide<u>s only</u> <s>a </s>conversion function<u>s</u> in <s>a </s>base class<u>es</u> <s>unless the two functions</s><u>that</u> convert to the same type. <u>A conversion function template with a dependent return type hides only templates in base classes that correspond to it ([class.member.lookup]); otherwise, it hides and is hidden as a non-template function.</u> Function overload resolution ([over.match.best]) selects the best conversion function to perform the conversion.<u> — <em>end note</em>]</u> [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
</div>
<h4 id="class.static">[class.static]</h4>
<h5 id="class.static.mfct">[class.static.mfct]</h5>
<p>Change paragraph 2:</p>
<blockquote>
<p>[<em>Note</em>: A static member function does not have a <code>this</code> pointer ([<s>class</s><u>expr.prim</u>.this]).<s> — <em>end note</em>] A static member function shall not be <code>virtual</code>. There shall not be a static and a non-static member function with the same name and the same parameter types ([over.load]).</s> A static member function <s>shall not be declared</s><u>cannot be qualified with</u> <code>const</code>, <code>volatile</code>, or <s><code>const volatile</code></s><u><code>virtual</code></u>.<u> — <em>end note</em>]</u></p>
</blockquote>
<h5 id="class.static.data">[class.static.data]</h5>
<p>Change paragraph 3:</p>
<blockquote>
<p>The declaration of a non-inline static data member in its class definition is not a definition and may be of an incomplete type other than <em>cv</em> <code>void</code>. <s>The definition for a static data member that is not defined inline in the class definition shall appear in a namespace scope enclosing the member’s class definition. In the definition at namespace scope, the name of the static data member shall be qualified by its class name using the <code>::</code> operator.</s> <u>[<em>Note</em>: </u>The <em>initializer</em><s> expression</s> in the definition of a static data member is in the scope of its class ([basic.scope.class]).<u> — <em>end note</em>]</u> [<em>Example</em>:</p>
<p>[…] — <em>end example</em>]</p>
<p>[<em>Note</em>: Once the static data member has been defined, it exists even if no objects of its class have been created. [<em>Example</em>: In the example above, <code>run_chain</code> and <code>running</code> exist even if no objects of class <code>process</code> are created by the program. — <em>end example</em>] <u>The initialization and destruction of static data members are described in [basic.start.static], [basic.start.dynamic], and [basic.start.term].</u> — <em>end note</em>]</p>
</blockquote>
<div class="del">
Remove paragraph 7 (re-expressed as the added note text above).
</div>
<h3 id="class.nest">[class.nest]</h3>
<p>Change paragraph 1:</p>
<blockquote>
<p>A class can be declared within another class. A class declared within another is called a <em>nested class</em>. <s>The name of a nested class is local to its enclosing class. The nested class is in the scope of its enclosing class.</s> [<em>Note</em>: See [expr.prim.id] for restrictions on the use of non-static data members and non-static member functions. — <em>end note</em>]</p>
<p>[<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 4:</p>
<blockquote>
<p><s>Like a member function, a</s><u>A</u> friend function ([class.friend]) defined within a nested class <s>is in the lexical scope of that class; it obeys the same rules for name binding as a static member function of that class ([class.static]), but it </s>has no special access rights to members of an enclosing class.</p>
</blockquote>
<div class="del">
<h3>[class.nested.type]</h3>
</div>
<p>Remove subclause, referring the stable name to [diff.basic]. Update the one cross reference (in [diff.class]/5) to refer to [class.member.lookup].</p>
<h3 id="class.union.anon">[class.union.anon]</h3>
<p>Change paragraph 1:</p>
<blockquote>
<p>A union of the form</p>
<blockquote>
<p><code>union</code> <code>{</code> <em>member-specification</em> <code>}</code> <code>;</code></p>
</blockquote>
<p>is called an <em>anonymous union</em>; it defines an unnamed type and an unnamed object of that type called an <em>anonymous union <s>object</s><u>member</u></em><u> if it is a non-static data member or an <em>anonymous union variable</em> otherwise</u>. Each <em>member-declaration</em> in the <em>member-specification</em> of an anonymous union shall either define <s>a</s><u>one or more</u> non-static data member<u>s</u> or be a <em>static_assert-declaration</em>. Nested types, anonymous unions, and functions shall not be declared within an anonymous union. The names of the members of an anonymous union <u>are bound in the scope inhabited by the union declaration and </u>shall be distinct from the names of any other entity in <s>the</s><u>that</u> scope<s> in which the anonymous union is declared</s>. <s>For the purpose of name lookup, after the anonymous union definition, the members of the anonymous union are considered to have been defined in the scope in which the anonymous union is declared.</s> [<em>Example</em>:</p>
<p>[…]</p>
<p>Here <code>a</code> and <code>p</code> are used like ordinary (non-member) variables, but since they are union members they have the same address. — <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 2:</p>
<blockquote>
<p>Anonymous unions declared <s>in a named</s><u>in the scope of a</u> namespace <s>or in the global namespace</s><u>with external linkage</u> shall be declared <code>static</code>. Anonymous unions declared at block scope shall be declared with any storage class allowed for a block<s>-scope</s> variable, or with no storage class. A storage class is not allowed in a declaration of an anonymous union in a class scope. An anonymous union shall not have private or protected members ([class.access]). An anonymous union shall not have member functions.</p>
</blockquote>
<h3 id="class.local">[class.local]</h3>
<p>Change paragraph 1:</p>
<blockquote>
<p>A class can be declared within a function definition; such a class is called a <em>local class</em>. <s>The name of a local class is local to its enclosing scope. The local class is in the scope of the enclosing scope, and has the same access to names outside the function as does the enclosing function.</s> [<em>Note</em>: […] — <em>end note</em>] [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<h3 id="class.derived">[class.derived]</h3>
<p>Change paragraph 2:</p>
<blockquote>
<p><u>The component names of a <em>class-or-decltype</em> are those of its <em>nested-name-specifier</em>, <em>type-name</em>, and/or <em>simple-template-id</em>.</u> A <em>class-or-decltype</em> shall denote a (possibly cv-qualified) class type that is not an incompletely defined class ([class.mem]); any cv-qualifiers are ignored. The class denoted by the <em>class-or-decltype</em> of a <em>base-specifier</em> is called a <em>direct base class</em> for the class being defined. <s>During t</s><u>T</u>he lookup for <s>a base class</s><u>the component</u> name<s>, non-type names are ignored</s><u> of the <em>type-name</em> or <em>simple-template-id</em> is type-only</u> ([basic.<s>scope.hiding</s><u>lookup</u>]). A class <code>B</code> is a base class of a class <code>D</code> if it is a direct base class of <code>D</code> or a direct base class of one of <code>D</code>’s base classes. A class is an <em>indirect base class</em> of another if it is a base class but not a direct base class. A class is said to be (directly or indirectly) <em>derived</em> from its (direct or indirect) base classes. [<em>Note</em>: See [class.access] for the meaning of <em>access-specifier</em>. — <em>end note</em>] <s>Unless redeclared in the derived class, members of a base class are also considered to be members of the derived class.</s> Members of a base class<s> other than constructors</s> are <s>said to be <em>inherited</em> by the</s><u>also members of the</u> derived class. <u>[<em>Note</em>:</u> Constructors of a base class can <s>also </s>be <u>explicitly </u>inherited<s> as described in</s> <u>(</u>[namespace.udecl]<u>)</u>. <s>Inherited</s><u>Base class</u> members can be referred to in expressions in the same manner as other members of the derived class, unless their names are hidden or ambiguous ([class.member.lookup]). <s>[<em>Note</em>: </s>The scope resolution operator <code>::</code> ([expr.prim.id.qual]) can be used to refer to a direct or indirect base member explicitly<s>. This allows access to a name that has been redeclared</s><u>, even if it is hidden</u> in the derived class. A derived class can itself serve as a base class subject to access control; see [class.access.base]. A pointer to a derived class can be implicitly converted to a pointer to an accessible unambiguous base class ([conv.ptr]). An lvalue of a derived class type can be bound to a reference to an accessible unambiguous base class ([dcl.init.ref]). — <em>end note</em>]</p>
</blockquote>
<h4 id="class.virtual">[class.virtual]</h4>
<p>Change paragraph 1:</p>
<blockquote>
<p>A non-static member function is a <em>virtual function</em> if it is first declared with the keyword <code>virtual</code> or if it overrides a virtual member function declared in a base class (see below).<sup>[…]</sup> [<em>Note</em>: Virtual functions support dynamic binding and object-oriented programming. — <em>end note</em>] A class <s>that declares or inherits</s><u>with</u> a virtual<u> member</u> function is called a <em>polymorphic class</em>.<sup>[…]</sup></p>
</blockquote>
<p>Change paragraph 2:</p>
<blockquote>
<p>If a virtual member function <s><code>vf</code></s><u><em>F</em></u> is declared in a class <s><code>Base</code></s><u><em>B</em></u> and in a class <s><code>Derived</code>,</s><u><em>D</em></u> derived <u>(</u>directly or indirectly<u>)</u> from <s><code>Base</code>,</s><u><em>B</em> a declaration of</u> a member function <s><code>vf</code> with the same name, parameter-type-list ([dcl.fct]), cv-qualification, and ref-qualifier (or absence of same) as <code>Base::vf</code> is declared</s><u><em>G</em> that corresponds ([basic.scope.scope]) to a declaration of <em>F</em>, ignoring trailing <em>requires-clause</em>s</u>, then <s><code>Derived::vf</code></s><u><em>G</em></u> <em>overrides</em><sup>[…]</sup> <s><code>Base::vf</code></s><u><em>F</em></u>. For convenience we say that any virtual function overrides itself. A virtual member function <s><code>C::vf</code></s><u><em>V</em></u> of a class object <code>S</code> is a <em>final overrider</em> unless the most derived class ([intro.object]) of which <code>S</code> is a base class subobject (if any) <s>declares or inherits</s><u>has</u> another member function that overrides <s><code>vf</code></s><u><em>V</em></u>. […]</p>
</blockquote>
<div class="del">
Remove paragraph 7.
</div>
<p>Change paragraph 9:</p>
<blockquote>
<p>If the class type in the covariant return type of <code>D::f</code> differs from that of <code>B::f</code>, the class type in the return type of <code>D::f</code> shall be complete at the <s>point</s><u>locus</u> of <u>the overriding </u>declaration<s> of <code>D::f</code></s> or shall be the class type <code>D</code>. When the overriding function is called as the final overrider of the overridden function, its result is converted to the type returned by the (statically chosen) overridden function ([expr.call]). [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<h4 id="class.abstract">[class.abstract]</h4>
<p>Change paragraph 4:</p>
<blockquote>
<p>A class is abstract if it <s>contains or inherits</s><u>has</u> at least one pure virtual function for which the final overrider is pure virtual. [<em>Example</em>:</p>
<p>[…] — <em>end example</em>]</p>
</blockquote>
<h3 id="class.access">[class.access]</h3>
<p>Change paragraph 1:</p>
<blockquote>
<p>A member of a class can be</p>
<ol style="list-style-type: decimal">
<li>private; that is, it<s>s name</s> can be <s>us</s><u>nam</u>ed only by members and friends of the class in which it is declared.</li>
<li>protected; that is, it<s>s name</s> can be <s>us</s><u>nam</u>ed only by members and friends of the class in which it is declared, by classes derived from that class, and by their friends (see [class.protected]).</li>
<li>public; that is, it<s>s name</s> can be <s>us</s><u>nam</u>ed anywhere without access restriction.</li>
</ol>
<p><u>[<em>Note</em>: A constructor or destructor can be named by an expression ([basic.def.odr]) even though it has no name. — <em>end note</em>]</u></p>
</blockquote>
<p>Change paragraph 2:</p>
<blockquote>
<p>A member of a class can also access all the <s>name</s><u>member</u>s to which the class has access. A local class of a member function may access the same <s>name</s><u>member</u>s that the member function itself may access.<sup>[…]</sup></p>
</blockquote>
<p>Change paragraph 4:</p>
<blockquote>
<p>Access control is applied uniformly to all names, whether the names are referred to from declarations or expressions. [<em>Note</em>: Access control applies to names nominated by friend declarations ([class.friend]) and <em>using-declaration</em>⁠s ([namespace.udecl]). — <em>end note</em>] In the case of overloaded function names, access control is applied to the function selected by overload resolution<u> or to the <em>using-declarator</em> nominating it, if any</u>. […]</p>
</blockquote>
<p>Change paragraph 5:</p>
<blockquote>
<p>[<em>Note</em>: Access<s> to members and base classes is</s> control<s>led, not their visibility ([basic.scope.hiding]). Names of</s><u> does not prevent</u> members <s>are still visible, and</s><u>from being found by name lookup or</u> implicit conversions to base classes <s>are still</s><u>from being</u> considered<s>, when those members and base classes are inaccessible</s>. — <em>end note</em>] The interpretation of a given construct is established without regard to access control. If the interpretation established makes use of inaccessible member names or base classes, the construct is ill-formed.</p>
</blockquote>
<p>Change paragraph 8:</p>
<blockquote>
<p><s>The</s><u>Access is checked for the</u> names in a default argument ([dcl.fct.default]) <s>are bound </s>at the point of declaration<s>, and access is checked at that point </s>rather than at any points of use of the default argument. Access checking for default arguments in function templates and in member functions of class templates is performed as described in [temp.inst].</p>
</blockquote>
<h4 id="class.friend">[class.friend]</h4>
<p>Change paragraph 2:</p>
<blockquote>
<p>Declaring a class to be a friend implies that the names of private and protected members from the class granting friendship can be accessed in the <em>base-specifier</em>⁠s and member declarations of the befriended class. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>] [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
<p><s>A class shall not be defined in a friend declaration. [<em>Example</em>:</s></p>
<p><s>[…]</s></p>
<p><s>— <em>end example</em>]</s></p>
</blockquote>
<p>Change paragraph 5:</p>
<blockquote>
<p><s>When a</s><u>[<em>Note</em>: A</u> friend declaration refers to an <s>overloaded</s><u>entity, not (all overloads of) a</u> name<s> or operator, only the function specified by the parameter types becomes a friend</s>. A member function of a class <code>X</code> can be a friend of a class <code>Y</code>. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]<u> — <em>end note</em>]</u></p>
</blockquote>
<p>Change paragraph 6:</p>
<blockquote>
<p>A function <s>can</s><u>may</u> be defined in a friend declaration of a class if and only if the class is a non-local class ([class.local])<s>,</s><u> and</u> the function name is unqualified<s>, and the function has namespace scope</s>. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 7:</p>
<blockquote>
<p>Such a function is implicitly an inline ([dcl.inline]) function if it is attached to the global module. <s>A friend function defined in a class is in the (lexical) scope of the class in which it is defined.</s> <u>[<em>Note</em>: If a</u><s>A</s> friend function <u>is </u>defined outside <s>the</s><u>a</u> class<u>, it</u> is not<u> in the scope of the class</u><s> ([basic.lookup.unqual])</s>.<u>— <em>end note</em>]</u></p>
</blockquote>
<div class="del">
Replace paragraph 11, adding the example from [namespace.memdef]/3 and then retaining its example:
</div>
<div class="ins">
<blockquote>
<p>[<em>Note</em>: A friend declaration never binds any names ([dcl.meaning], [dcl.type.elab]). — <em>end note</em>] [<em>Example</em>:</p>
<p>[… from [namespace.memdef]/2]</p>
<p>— <em>end example</em>] [<em>Example</em>:</p>
<p>[… from [class.friend]/11]</p>
<p>— <em>end example</em>]</p>
</blockquote>
</div>
<h4 id="class.paths">[class.paths]</h4>
<p>Change paragraph 1:</p>
<blockquote>
<p>If a <s>name</s><u>declaration</u> can be reached by several paths through a multiple inheritance graph, the access is that of the path that gives most access. [<em>Example</em>:</p>
<p>[…] — <em>end example</em>]</p>
</blockquote>
<h3 id="class.init">[class.init]</h3>
<h4 id="class.base.init">[class.base.init]</h4>
<p>Change paragraph 2:</p>
<blockquote>
<p><s>In</s><u>Lookup for an unqualified name in</u> a <em>mem-initializer-id</em> <s>an initial unqualified <em>identifier</em> is looked up in the scope of the constructor’s class and, if not found in that scope, it is looked up in the scope containing the constructor’s definition</s><u>ignores the constructor’s function parameter scope</u>.<!-- remote --> [<em>Note</em>: If the constructor’s class contains a member with the same name as a direct or virtual base class of the class, a <em>mem-initializer-id</em> naming the member or base class and composed of a single identifier refers to the class member. A <em>mem-initializer-id</em> for the hidden base class may be specified using a qualified name. — <em>end note</em>] Unless the <em>mem-initializer-id</em> names the constructor’s class, a non-static data member of the constructor’s class, or a direct or virtual base of that class, the <em>mem-initializer</em> is ill-formed.</p>
</blockquote>
<p>Change paragraph 4:</p>
<blockquote>
<p>If a <em>mem-initializer-id</em> is ambiguous because it designates both a direct non-virtual base class and an <s>inherited</s><u>indirect</u> virtual base class, the <em>mem-initializer</em> is ill-formed. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 15:</p>
<blockquote>
<p><s>Names in t</s><u>[<em>Note</em>: T</u>he <em>expression-list</em> or <em>braced-init-list</em> of a <em>mem-initializer</em> <s>are evaluated</s><u>is</u> in the <u>function parameter </u>scope of the constructor <s>for which the <em>mem-initializer</em> is specified.</s><u>and can use <code>this</code> to refer to the object being initialized. — <em>end note</em>]</u> [<em>Example</em>:</p>
<p>[…]</p>
<p>initializes <code>X::r</code> to refer to <code>X::a</code>, initializes <code>X::b</code> with the value of the constructor parameter <code>i</code>, initializes <code>X::i</code> with the value of the constructor parameter <code>i</code>, and initializes <code>X::j</code> with the value of <code>X::i</code>; this takes place each time an object of class <code>X</code> is created. — <em>end example</em>] <s>[<em>Note</em>: Because the <em>mem-initializer</em> are evaluated in the scope of the constructor, the <code>this</code> pointer can be used in the <em>expression-list</em> of a <em>mem-initializer</em> to refer to the object being initialized. — <em>end note</em>]</s></p>
</blockquote>
<h4 id="class.copy.elision">[class.copy.elision]</h4>
<p>Change bullet (1.2):</p>
<blockquote>
<p>in a <em>throw-expression</em> ([expr.throw]), when the operand is the name of a non-volatile object with automatic storage duration (other than a function or catch-clause parameter) <s>whose</s><u>that belongs to a</u> scope <u>that </u>does not <s>extend beyond the end of</s><u>contain</u> the innermost enclosing <u><em>compound-statement</em> associated with a </u><em>try-block</em> (if there is one), the copy/move operation can be omitted by constructing the object directly into the exception object<!-- FIXME: this transcends lambdas (preexisting, here and in /3.2) --></p>
</blockquote>
<p>Change paragraph 2:</p>
<blockquote>
<p>[<em>Example</em>:</p>
<p>[…]</p>
<p>Here the criteria for elision can eliminate the copying of the object <code>t</code> with automatic storage duration into the result object for the function call <code>f()</code>, which is the <s>global</s><u>non-local</u> object <code>t2</code>. Effectively, the construction of <s>the local object </s><code>t</code> can be viewed as directly initializing <s>the global object </s><code>t2</code>, and that object’s destruction will occur at program exit. Adding a move constructor to <code>Thing</code> has the same effect, but it is the move construction from the object with automatic storage duration to <code>t2</code> that is elided. — <em>end example</em>]</p>
</blockquote>
<p>Change bullet (3.2):</p>
<blockquote>
<p>if the operand of a <em>throw-expression</em> ([expr.throw]) is a (possibly parenthesized) <em>id-expression</em> that names an implicitly movable entity <s>whose</s><u>that belongs to a</u> scope <u>that </u>does not <s>extend beyond</s><u>contain</u> the <em>compound-statement</em> of the innermost <em>try-block</em> or <em>function-try-block</em> (if any) whose <em>compound-statement</em> or <em>ctor-initializer</em> <s>encloses</s><u>contains</u> the <em>throw-expression</em>,</p>
</blockquote>
<h2 id="class.free">[class.free]</h2>
<div class="del">
<p>Remove paragraph 3.</p>
Remove paragraph 4, part of which is incorporated in [expr.delete] (<em>q.v.</em>).
</div>
<p>Change paragraph 7:</p>
<blockquote>
<p>Access to the deallocation function is checked statically<s>. Hence</s>, even though a different one might actually be executed<s>, the statically visible deallocation function is required to be accessible</s>. [<em>Example</em>: For the call on line “// 1” above, if <code>B::operator delete()</code> had been private, the delete expression would have been ill-formed. — <em>end example</em>]</p>
</blockquote>
<h2 id="over">[over]</h2>
<h3 id="over.pre">[over.pre]</h3>
<p>Change paragraph 2:</p>
<blockquote>
<p>When a function <s>name </s>is <s>us</s><u>nam</u>ed in a call, which function declaration is being referenced and the validity of the call are determined by comparing the types of the arguments at the point of use with the types of the parameters in the declarations <s>that are visible at the point of use</s><u>in the overload set</u>. This function selection process is called <em>overload resolution</em> and is defined in [over.match]. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<div class="del">
<h3>[over.load]</h3>
</div>
<p>Remove subclause, referring the stable name to [basic.scope.scope]. Update the surviving cross reference (in [class.mem]/5.2) to refer to [basic.scope.scope].</p>
<p>Parts of the notes and examples are adapted in [basic.scope.scope]/3 and [dcl.fct]/5.</p>
<div class="del">
<h3>[over.dcl]</h3>
</div>
<p>Remove subclause, referring the stable name (which has no cross references) to [basic.link].</p>
<p>The first example in paragraph 1 is moved to [temp.over.link]/5.</p>
<h3 id="over.match">[over.match]</h3>
<h4 id="over.match.funcs">[over.match.funcs]</h4>
<p>Insert before paragraph 7:</p>
<div class="ins">
<blockquote>
<p>In each case where conversion functions of a class <code>S</code> are considered for initializing an object or reference of type <code>T</code>, the candidate functions include the result of a search for the <em>conversion-function-id</em> <code>operator T</code> in <code>S</code>. [<em>Note</em>: This search may find a specialization of a conversion function template ([basic.lookup]). — <em>end note</em>] Each such case also defines sets of permissible types for explicit and non-explicit conversion functions; each (non-template) conversion function that is a non-hidden member of <code>S</code>, yields a permissible type, and, for the former set, is non-explicit is also a candidate function. If initializing an object, for any permissible type <em>cv</em> <code>U</code>, any <em>cv2</em> <code>U</code>, <em>cv2</em> <code>U&amp;</code>, or <em>cv2</em> <code>U&amp;&amp;</code> is also a permissible type. If the set of permissible types for explicit conversion functions is empty, any candidates that are explicit are discarded.</p>
</blockquote>
</div>
<p>Change paragraph 7:</p>
<blockquote>
<p>In each case where a candidate is a function template, candidate function template specializations are generated using template argument deduction ([temp.over], [temp.deduct]). If a constructor template or conversion function template has an <em>explicit-specifier</em> whose <em>constant-expression</em> is value-dependent ([temp.dep]), template argument deduction is performed first and then, if the context <s>requires a</s><u>admits only</u> candidate<u>s</u> that <s>is</s><u>are</u> not explicit and the generated specialization is explicit ([dcl.fct.spec]), it will be removed from the candidate set. Those candidates are then handled as candidate functions in the usual way.<sup>[…]</sup> A given name can refer to<u>, or a conversion can consider,</u> one or more function templates <s>and also to</s><u>as well as</u> a set of non-template functions. In such a case, the candidate functions generated from each function template are combined with the set of non-template candidate functions.</p>
</blockquote>
<h5 id="over.call.func">[over.call.func]</h5>
<p>Change paragraph 1:</p>
<blockquote>
<p>Of interest in [over.call.func] are only those function calls in which the <em>postfix-expression</em> ultimately contains a<u>n <em>id-expression</em></u><s> name</s> that denotes one or more functions that might be called. […]</p>
</blockquote>
<p>Change paragraph 2:</p>
<blockquote>
<p>In qualified function calls, the <s>name to be resolved</s><u>function</u> is <u>named by </u>an <em>id-expression</em> <s>and is </s>preceded by an <code>-&gt;</code> or <code>.</code> operator. Since the construct <code>A-&gt;B</code> is generally equivalent to <code>(*A).B</code>, the rest of [over.pre] assumes, without loss of generality, that all member function calls have been normalized to the form that uses an object and the <code>.</code> operator. Furthermore, [over.pre] assumes that the <em>postfix-expression</em> that is the left operand of the <code>.</code> operator has type “<em>cv</em> <code>T</code>” where <code>T</code> denotes a class.<sup>[…]</sup> <s>Under this assumption, the <em>id-expression</em> in the call is looked up as a member function of <code>T</code> following the rules for looking up names in classes ([class.member.lookup]).</s> The function declarations found by <s>that</s><u>name</u> lookup<u> ([class.member.lookup])</u> constitute the set of candidate functions. The argument list is the <em>expression-list</em> in the call augmented by the addition of the left operand of the <code>.</code> operator in the normalized member function call as the implied object argument ([over.match.funcs]).</p>
</blockquote>
<p>Change paragraph 3:</p>
<blockquote>
<p>In unqualified function calls, the <u>function is </u>name<u>d</u> <s>is not qualified </s>by<s> an <code>-&gt;</code> or <code>.</code> operator and has the more general form of</s> a <em>primary-expression</em>. <s>The name is looked up in the context of the function call following the normal rules for name lookup in expressions ([basic.lookup]).</s> The function declarations found by <s>that</s><u>name</u> lookup<u> ([basic.lookup])</u> constitute the set of candidate functions. Because of the rules for name lookup, the set of candidate functions consists (1) entirely of non-member functions or (2) entirely of member functions of some class <code>T</code>. In case (1), the argument list is the same as the <em>expression-list</em> in the call. In case (2), the argument list is the <em>expression-list</em> in the call augmented by the addition of an implied object argument as in a qualified function call. If <u>the current class is, or is derived, from <code>T</code> and </u>the keyword <code>this</code> ([<s>class</s><u>expr.prim</u>.this]) <s>is in scope and </s>refers to <s>class <code>T</code>, or a derived class of <code>T</code></s><u>it</u>, then the implied object argument is <code>(*this)</code>. <s>If the keyword <code>this</code> is not in scope or refers to another class, then</s><u>Otherwise,</u> a contrived object of type <code>T</code> becomes the implied object argument<s>.</s><sup>[…]</sup><u>;</u> <s>If the argument list is augmented by a contrived object and</s><u>if</u> overload resolution selects <s>one of the</s><u>a</u> non-static member function<s>s of <code>T</code></s>, the call is ill-formed.</p>
</blockquote>
<h5 id="over.call.object">[over.call.object]</h5>
<p>Change paragraph 1:</p>
<blockquote>
<p>If the <em>postfix-expression</em> <code>E</code> in the function call syntax evaluates to a class object of type “<em>cv</em> <code>T</code>”, then the set of candidate functions includes at least the function call operators of <code>T</code>. The function call operators of <code>T</code> are <s>obtained by ordinary lookup</s><u>the results</u> of <u>a search for </u>the name <code>operator()</code> in the <s>context</s><u>scope</u> of <s><code>(E).operator()</code></s><u><code>T</code></u>.</p>
</blockquote>
<h5 id="over.match.oper">[over.match.oper]</h5>
<p>Change bullet (3.2):</p>
<blockquote>
<p><s>The</s><u>For the operators <code>=</code>, <code>[]</code>, or <code>-&gt;</code>, the</u> set of non-member candidates is<u> empty; otherwise, it includes</u> the result of <s>the </s>unqualified lookup <s>of</s><u>for</u> <code>operator@</code> <s>in the context of the expression according to the usual rules for name lookup in unqualified</s><u>in the rewritten</u> function call<s>s</s> (<u>[basic.lookup.unqual], </u>[basic.lookup.argdep])<s> except that</s><u>, ignoring</u> all member functions<s> are ignored</s>. However, if no operand has a class type, only those non-member functions in the lookup set that have a first parameter of type <code>T1</code> or “reference to <em>cv</em> <code>T1</code>”, when <code>T1</code> is an enumeration type, or (if there is a right operand) a second parameter of type <code>T2</code> or “reference to <em>cv</em> <code>T2</code>”, when <code>T2</code> is an enumeration type, are candidate functions.</p>
</blockquote>
<h5 id="over.match.copy">[over.match.copy]</h5>
<p>Change bullet (1.2):</p>
<blockquote>
<p>When the type of the initializer expression is a class type “<em>cv</em> <code>S</code>”, <s>the non-explicit </s>conversion functions<s> of <code>S</code> and its base classes</s> are considered. <u>The permissible types for non-explicit conversion functions are <code>T</code> and any class derived from <code>T</code>.</u> When initializing a temporary object ([class.mem]) to be bound to the first parameter of a constructor where the parameter is of type “reference to <em>cv2</em> <code>T</code>” and the constructor is called with a single argument in the context of direct-initialization of an object of type “<em>cv3</em> <code>T</code>”, <u>the permissible types for </u>explicit conversion functions are <s>also considered</s><u>the same; otherwise there are none</u>. <s>Those that are not hidden within <code>S</code> and yield a type whose cv-unqualified version is the same type as <code>T</code> or is a derived class thereof are candidate functions. A call to a conversion function returning “reference to <code>X</code>” is a glvalue of type <code>X</code>, and such a conversion function is therefore considered to yield <code>X</code> for this process of selecting candidate functions.</s></p>
</blockquote>
<h5 id="over.match.conv">[over.match.conv]</h5>
<p>Change paragraph 1:</p>
<blockquote>
<p>Under the conditions specified in [dcl.init], as part of an initialization of an object of non-class type, a conversion function can be invoked to convert an initializer expression of class type to the type of the object being initialized. Overload resolution is used to select the conversion function to be invoked. Assuming that “<em>cv<s>1</s></em> <code>T</code>” is the type of the object being initialized<s>, and “<em>cv</em> <code>S</code>” is the type of the initializer expression, with <code>S</code> a class type</s>, the candidate functions are selected as follows:</p>
<ol style="list-style-type: decimal">
<li>The <s>conversion functions of <code>S</code> and its base classes are considered. Those</s><u>permissible types for</u> non-explicit conversion functions <s>that </s>are <s>not hidden within <code>S</code> and yield type <code>T</code> or a type</s><u>those</u> that can be converted to type <code>T</code> via a standard conversion sequence ([over.ics.scs])<s> are candidate functions</s>. For direct-initialization, <s>those</s><u>the permissible types for</u> explicit conversion functions <s>that </s>are <s>not hidden within <code>S</code> and yield type <code>T</code> or a type</s><u>those</u> that can be converted to type <code>T</code> with a <u>(possibly trivial) </u>qualification conversion ([conv.qual])<s> are also candidate functions</s><u>; otherwise there are none</u>. <s>Conversion functions that return a cv-qualified type are considered to yield the cv-unqualified version of that type for this process of selecting candidate functions. A call to a conversion function returning “reference to <code>X</code>” is a glvalue of type <code>X</code>, and such a conversion function is therefore considered to yield <code>X</code> for this process of selecting candidate functions.</s></li>
</ol>
</blockquote>
<h5 id="over.match.ref">[over.match.ref]</h5>
<p>Change paragraph 1:</p>
<blockquote>
<p>Under the conditions specified in [dcl.init.ref], a reference can be bound directly to the result of applying a conversion function to an initializer expression. Overload resolution is used to select the conversion function to be invoked. Assuming that “reference to <em>cv1</em> <code>T</code>” is the type of the reference being initialized<s>, and “<em>cv</em> <code>S</code>” is the type of the initializer expression, with <code>S</code> a class type</s>, the candidate functions are selected as follows:</p>
<ol style="list-style-type: decimal">
<li><s>The conversion functions of <code>S</code> and its base classes are considered. Those non-explicit conversion functions that are not hidden within <code>S</code> and yield</s><u>Let <em>R</em> be a set of</u> type<u>s including</u> “lvalue reference to <em>cv2</em> <code>T2</code>” (when initializing an lvalue reference or an rvalue reference to function) <s>or</s><u>and</u> “<em>cv2</em> <code>T2</code>” <s>or</s><u>and</u> “rvalue reference to <em>cv2</em> <code>T2</code>” (when initializing an rvalue reference or an lvalue reference to function)<s>,</s><u> for any <code>T2</code>. The permissible types for non-explicit conversion functions are the members of <em>R</em></u> where “<em>cv1</em> <code>T</code>” is reference-compatible ([dcl.init.ref]) with “<em>cv2</em> <code>T2</code>”<s>, are candidate functions</s>. For direct-initialization, <s>those</s><u>the permissible types for</u> explicit conversion functions <s>that </s>are <s>not hidden within <code>S</code> and yield type “lvalue reference to <em>cv2</em> <code>T2</code>” (when initializing an lvalue reference or an rvalue reference to function) or “rvalue reference to <em>cv2</em> <code>T2</code>” (when initializing an rvalue reference or an lvalue reference to function),</s><u>the members of <em>R</em></u> where <code>T2</code> <s>is the same type as <code>T</code> or </s>can be converted to type <code>T</code> with a <u>(possibly trivial) </u>qualification conversion ([conv.qual])<s>, are also candidate functions</s><u>; otherwise there are none</u>.</li>
</ol>
</blockquote>
<h4 id="over.match.best">[over.match.best]</h4>
<p>Change paragraph 4:</p>
<blockquote>
<p>If the best viable function resolves to a function for which multiple declarations were found, and if <s>at least</s><u>any</u> two of these declarations <s>— or the declarations they refer to in the case of <em>using-declaration</em>⁠s —</s><u>inhabit different scopes and</u> specify a default argument that made the function viable, the program is ill-formed. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<h3 id="over.over">[over.over]</h3>
<p>Change paragraph 1:</p>
<blockquote>
<p><s>A use of a function name</s><u>An <em>id-expression</em> whose name refers to an overload set <em>S</em> and that appears</u> without arguments is resolved to a function, a pointer to function, or a pointer to member function for a specific function that is chosen from a set of <s>selected </s>functions<u> selected from <em>S</em></u> determined based on the target type required in the context (if any), as described below. The target can be</p>
<ol style="list-style-type: decimal">
<li>an object or reference being initialized ([dcl.init], [dcl.init.ref], [dcl.init.list]),</li>
<li>the left side of an assignment ([expr.ass]),</li>
<li>a parameter of a function ([expr.call]),</li>
<li>a parameter of a user-defined operator ([over.oper]),</li>
<li>the return value of a function, operator function, or conversion ([stmt.return]),</li>
<li>an explicit type conversion ([expr.type.conv], [expr.static.cast], [expr.cast]), or</li>
<li>a non-type <em>template-parameter</em> ([temp.arg.nontype]).</li>
</ol>
<p>The <s>function name</s><u><em>id-expression</em></u> can be preceded by the <code>&amp;</code> operator. [<em>Note</em>: Any redundant set of parentheses surrounding the function name is ignored ([expr.prim.paren]). — <em>end note</em>]</p>
</blockquote>
<p>Change paragraph 3:</p>
<blockquote>
<p><s>For each function template designated by the name,</s><u>The specialization, if any, generated by</u> template argument deduction<s> is done</s> (<u>[temp.over], </u>[temp.deduct.funcaddr]<u>, [temp.arg.explicit]</u>)<s>, and if the argument deduction succeeds, the resulting template argument list is used to generate a single</s><u> for each</u> function template <s>specialization, which</s><u>named</u> is added to the set of selected functions considered. <s>[<em>Note</em>: […] — <em>end note</em>]</s></p>
</blockquote>
<p>Change paragraph 4:</p>
<blockquote>
<p>Non-member functions and static member functions match targets of function pointer type or reference to function type. Non-static member functions match targets of pointer-to-member-function type. <u>[<em>Note</em>: </u>If a non-static member function is <s>selected</s><u>chosen</u>, the <s>reference to the overloaded function name is required to have the form of</s><u>result can be used only to form</u> a pointer to member<s> as described in</s> <u>(</u>[expr.unary.op]<u>)</u>.<u> — <em>end note</em>]</u></p>
</blockquote>
<h3 id="over.oper">[over.oper]</h3>
<h4 id="over.unary">[over.unary]</h4>
<p>Change paragraph 2:</p>
<blockquote>
<p><u>[<em>Note</em>: </u>The unary and binary forms of the same operator <s>are considered to </s>have the same name. <s>[<em>Note</em>: </s>Consequently, a unary operator can hide a binary operator from an enclosing scope, and vice versa. — <em>end note</em>]</p>
</blockquote>
<h4 id="over.literal">[over.literal]</h4>
<p>Change paragraph 2:</p>
<blockquote>
<p>A declaration whose <em>declarator-id</em> is a <em>literal-operator-id</em> shall <s>be a declaration of</s><u>declare</u> a <s>namespace-scope </s>function or function template<u> that belongs to a namespace</u> (it could be a friend function ([class.friend]))<s>,</s><u> or</u> an explicit instantiation or specialization of a function template<s>, or a <em>using-declaration</em> ([namespace.udecl])</s>. A function declared with a <em>literal-operator-id</em> is a <em>literal operator</em>. A function template declared with a <em>literal-operator-id</em> is a <em>literal operator template</em>.</p>
</blockquote>
<h2 id="temp">[temp]</h2>
<h3 id="temp.pre">[temp.pre]</h3>
<p>Change paragraph 4:</p>
<blockquote>
<p><u>[<em>Note</em>: </u>A <em>template-declaration</em> can appear only as a namespace scope or class scope declaration.<u> — <em>end note</em>]</u> Its <em>declaration</em> shall not be an <em>export-declaration</em>. In a function template declaration, the <s>last component</s><u><em>unqualified-id</em></u> of the <em>declarator-id</em> shall <s>not </s>be a <s><em>template-id</em></s><u>name</u>. [<em>Note</em>: <s>That last component may be an <em>identifier</em>, an <em>operator-function-id</em>, a <em>conversion-function-id</em>, or a <em>literal-operator-id</em>.</s> In a class template declaration, if the <s>class name</s><u><em>class-name</em></u> is a <em>simple-template-id</em>, the declaration declares a class template partial specialization ([temp.class.spec]). — <em>end note</em>]</p>
</blockquote>
<p>Change paragraph 6:</p>
<blockquote>
<p><s>A template name has linkage ([basic.link]).</s> <u>A s</u><s>S</s>pecialization<s>s</s> (explicit or implicit) of <s>a</s><u>one</u> template<s> that has internal linkage</s> are distinct from all specializations <s>in</s><u>of any</u> other <s>translation units</s><u>template</u>. A template, a template explicit specialization ([temp.expl.spec]), and a class template partial specialization shall not have C linkage. <s>Use of a linkage specification other than <code>&quot;C&quot;</code> or <code>&quot;C++&quot;</code> with any of these constructs is conditionally-supported, with implementation-defined semantics. Template definitions shall obey the one-definition rule ([basic.def.odr]).</s> [<em>Note</em>: Default arguments for function templates and for member functions of class templates are considered definitions for the purpose of template instantiation ([temp.decls]) and must<s> also</s> obey the one-definition rule<u> ([basic.def.odr])</u>. — <em>end note</em>]</p>
</blockquote>
<p>Change paragraph 7:</p>
<blockquote>
<p><u>[<em>Note</em>: </u>A <s>class </s>template <s>shall </s><u>can</u>not have the same name as any other <s>template, class, function, variable, enumeration, enumerator, namespace, or type</s><u>name bound</u> in the same scope ([basic.scope<u>.scope</u>]), except <s>as specified in [temp.class.spec]. Except </s>that a function template can be overloaded <s>either by</s><u>with</u> non-template functions ([dcl.fct]) <s>with the same name or by other</s><u>and/or</u> function templates<s> with the same name</s> ([temp.over])<s>, a template name declared in namespace scope or in class scope shall be unique in that scope</s>. <u>Specializations, including partial specializations ([temp.class.spec]), do not reintroduce or bind names. Their target scope is that of the primary template, so all specializations of a template belong to its scope. — <em>end note</em>]</u></p>
</blockquote>
<p>Change paragraph 8:</p>
<blockquote>
<p>[<em>Note</em>: A local class, a local<u> or block</u> variable, or a friend function defined in a templated entity is a templated entity. — <em>end note</em>]</p>
</blockquote>
<h3 id="temp.param">[temp.param]</h3>
<p>Change paragraph 1:</p>
<blockquote>
<p>[…]</p>
<p><u>The component names of a <em>type-constraint</em> are its <em>concept-name</em> and those of its <em>nested-name-specifier</em> (if any).</u> [<em>Note</em>: The <code>&gt;</code> token following the <em>template-parameter-list</em> of a <em>type-parameter</em> may be the product of replacing a <code>&gt;&gt;</code> token by two consecutive <code>&gt;</code> tokens ([temp.names]). — <em>end note</em>]</p>
</blockquote>
<p>Change paragraph 15:</p>
<blockquote>
<p>A <em>template-parameter</em> shall not be given default arguments by two different declarations <s>in the same scope</s><u>if one is reachable from the other</u>. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<h3 id="temp.names">[temp.names]</h3>
<p>Change paragraph 1:</p>
<blockquote>
<p>[…]</p>
<p><s>[<em>Note</em>: The name lookup rules ([basic.lookup]) are used to associate the use of a name with a template declaration; that is, to identify a name as a <em>template-name</em>. — <em>end note</em>]</s> <u>The component name of a <em>simple-template-id</em>, <em>template-id</em>, or <em>template-name</em> is the first name in it.</u></p>
</blockquote>
<p>Change paragraph 2:</p>
<blockquote>
<p><s>For a <em>template-name</em> to be explicitly qualified by the template arguments, the name must be considered to refer to a template. [<em>Note</em>: Whether a name actually refers to a template cannot be known in some cases until after argument dependent lookup is done ([basic.lookup.argdep]). — <em>end note</em>]</s> A <s>name</s><u><code>&lt;</code></u> is <s>considered to refer to</s><u>interpreted as the delimiter of</u> a <s>template</s><u><em>template-argument-list</em></u> if<u> it follows a name that is not a <em>conversion-function-id</em> and</u></p>
<ol style="list-style-type: decimal">
<li><u>that follows the keyword <code>template</code> after a <em>nested-name-specifier</em> or in a class member access expression, or</u></li>
<li><u>for which </u>name lookup finds <s>a <em>template-name</em> or an overload set that contains a function template.</s><u>the injected-class-name of a class template or finds any declaration of a template, or</u></li>
<li><s>A name is also considered to refer to a template if it</s><u>that</u> is an <s><em>unqualified-id</em> followed by a <code>&lt;</code> and</s><u>unqualified name for which</u> name lookup either finds one or more functions or finds nothing<s>.</s><u>, or</u></li>
<li><u>that is a terminal name in a <em>using-declarator</em> ([namespace.udecl]), a <em>declarator-id</em> ([dcl.meaning]), or a type-only context ([temp.res]).</u></li>
</ol>
<p><u>[<em>Note</em>: If the name is an <em>identifier</em>, it is then interpreted as a <em>template-name</em>. The keyword <code>template</code> is used to indicate that a dependent qualified name ([temp.dep.type]) denotes a template where an expression might appear. — <em>end note</em>]</u></p>
</blockquote>
<p>Move the example from paragraph 4 to the end of paragraph 2.</p>
<p>Change paragraph 3:</p>
<blockquote>
<p><s>When a name is considered to be a <em>template-name</em>, and it is followed by a <code>&lt;</code>, the <code>&lt;</code> is always taken as the delimiter of a <em>template-argument-list</em> and never as the less-than operator.</s> When parsing a <em>template-argument-list</em>, the first non-nested <code>&gt;</code><sup>[…]</sup> is taken as the ending delimiter rather than a greater-than operator. Similarly, the first non-nested <code>&gt;&gt;</code> is treated as two consecutive but distinct <code>&gt;</code> tokens, the first of which is taken as the end of the <em>template-argument-list</em> and completes the <em>template-id</em>. [<em>Note</em>: The second <code>&gt;</code> token produced by this replacement rule may terminate an enclosing <em>template-id</em> construct or it may be part of a different construct (e.g., a cast).— <em>end note</em>] [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 4:</p>
<blockquote>
<p>The keyword <code>template</code> <s>is said to appear at the top level in a <em>qualified-id</em> if it appears outside of a <em>template-argument-list</em> or <em>decltype-specifier</em>. In a <em>qualified-id</em> of a <em>declarator-id</em> or in a <em>qualified-id</em> formed by a <em>class-head-name</em> ([class.pre]) or <em>enum-head-name</em> ([dcl.enum]), the keyword <code>template</code> </s>shall not appear <s>at the top level</s><u>immediately after a declarative <em>nested-name-specifier</em> ([expr.prim.id.qual])</u>. <s>In a <em>qualified-id</em> used as the name in a <em>typename-specifier</em> ([temp.res]), <em>elaborated-type-specifier</em> ([dcl.type.elab]), <em>using-declaration</em> ([namespace.udecl]), or <em>class-or-decltype</em> ([class.derived]), an optional keyword <code>template</code> appearing at the top level is ignored. In these contexts, a <code>&lt;</code> token is always assumed to introduce a <em>template-argument-list</em>. In all other contexts, when naming a template specialization of a member of an unknown specialization ([temp.dep.type]), the member template name shall be prefixed by the keyword <code>template</code>. [<em>Example</em>:</s></p>
<p><s>[…]</s></p>
<p><s>— <em>end example</em>]</s></p>
</blockquote>
<p>Change paragraph 5:</p>
<blockquote>
A name prefixed by the keyword <code>template</code> shall be <s>a <em>template-id</em></s><u>followed by a template argument list</u> or <s>the name shall </s>refer to a class template or an alias template. <u>The latter case is deprecated ([depr.template.template]). The keyword <code>template</code> shall not appear immediately before a <code>~</code> token (as to name a destructor).</u> [<em>Note</em>: The keyword <code>template</code> may not be applied to non-template members of class templates. — <em>end note</em>][<em>Note</em>: As is the case with the <code>typename</code> prefix, the <code>template</code> prefix is allowed <s>in cases where it is not strictly necessary; i.e., when the <em>nested-name-specifier</em> or the expression on the left of the <code>-&gt;</code> or <code>.</code> is not dependent on a <em>template-parameter</em>, or the use does not appear in the scope of</s><u>even when lookup for the name would already find</u> a template. — <em>end note</em>] [<em>Example</em>:
<pre class="cpp">
template &lt;class T&gt; struct A {
  void f(int);
  template &lt;class U&gt; void f(U);
};

template &lt;class T&gt; void f(T t) {
  A&lt;T&gt; a;
  a.template f&lt;&gt;(t);                    // OK: calls template
  a.template f(t);                      // error: not a template-id
}

template &lt;class T&gt; struct B {
  template &lt;class T2&gt; struct C { };
};

// <s>OK</s><u>deprecated</u>: T::<s>template </s>C <u>would be assumed to </u>name<s>s</s> a class template:
template &lt;class T, template &lt;class X&gt; class TT = T::template C&gt; struct D { };
D&lt;B&lt;int&gt; &gt; db;
</pre>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 7:</p>
<blockquote>
<p>When the <em>template-name</em> of a <em>simple-template-id</em> names a constrained non-function template or a constrained template <em>template-parameter</em><s>, but not a member template that is a member of an unknown specialization ([temp.res])</s>, and all <em>template-argument</em>⁠s in the <em>simple-template-id</em> are non-dependent ([temp.dep.temp]), the associated constraints ([temp.constr.decl]) of the constrained template shall be satisfied ([temp.constr.constr]). [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<h3 id="temp.arg">[temp.arg]</h3>
<p>Insert before paragraph 2:</p>
<div class="ins">
<blockquote>
<p>The template argument list of a <em>template-head</em> is a template argument list in which the <em>n</em><sup>th</sup> template argument has the value of the <em>n</em><sup>th</sup> template parameter of the <em>template-head</em>. If the <em>n</em><sup>th</sup> template parameter is a template parameter pack ([temp.variadic]), the <em>n</em><sup>th</sup> template argument is a pack expansion whose pattern is the name of the template parameter pack.</p>
</blockquote>
</div>
<p>Change paragraph 3:</p>
<blockquote>
<p><s>The name of</s><u>[<em>Note</em>: Names used in</u> a <em>template-argument</em> <s>shall be accessible at the point where it is used as a <em>template-argument</em></s><u>are subject to access control where they appear</u>. <s>[<em>Note</em>: If the name of the <em>template-argument</em> is accessible at the point where it is used as a <em>template-argument</em>, there is no further access restriction in the resulting instantiation where the corresponding</s><u>Since a</u> <em>template-parameter</em><s> name</s> is <s>used</s><u>not a class member, no access control applies</u>. — <em>end note</em>] [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>] For a <em>template-argument</em> that is a class type or a class template, the template definition has no special access rights to the members of the <em>template-argument</em>. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 7:</p>
<blockquote>
<p>When name lookup for the name in a <em>template-id</em> finds an overload set, both non-template functions in the overload set and function templates in the overload set for which the <em>template-argument</em>⁠s do not match the <em>template-parameter</em>⁠s are ignored. <u>[<em>Note</em>: </u>If none of the function templates have matching <em>template-parameter</em>⁠s, the program is ill-formed.<u> — <em>end note</em>]</u></p>
</blockquote>
<h4 id="temp.arg.template">[temp.arg.template]</h4>
<p>Change paragraph 2:</p>
<blockquote>
<p>Any partial specializations ([temp.class.spec]) associated with the primary class template or primary variable template are considered when a specialization based on the template <em>template-parameter</em> is instantiated. If a specialization is not <s>visible at</s><u>reachable from</u> the point of instantiation, and it would have been selected had it been <s>visible</s><u>reachable</u>, the program is ill-formed, no diagnostic required. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<h3 id="temp.decls">[temp.decls]</h3>
<h4 id="temp.class">[temp.class]</h4>
<p>Change paragraph 3:</p>
<blockquote>
<p><u>[<em>Note</em>: </u>When a member<s> function, a member class, a member enumeration, a static data member or a member template</s> of a class template is defined outside of the class template definition, the member definition is defined as a template definition <s>in which the</s><u>with a</u> <em>template-head</em><s> is</s> equivalent to that of the class template<s> ([temp.over.link])</s>. The names of the template parameters used in the definition of the member <s>may be different</s><u>can differ</u> from the template parameter names used in the class template definition. The <s>template argument list following the </s>class template name in the member definition <s>shall name the parameters in the same order as the one used in the template parameter list of the member</s><u>is followed by the template argument list of the <em>template-head</em> ([temp.arg])</u>. <s>Each template parameter pack shall be expanded with an ellipsis in the template argument list.</s> [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>] <u>— <em>end note</em>]</u></p>
</blockquote>
<p>Change paragraph 4:</p>
<blockquote>
<p>In a <s>redeclaration, </s>partial specialization, explicit specialization or explicit instantiation of a class template, the <em>class-key</em> shall agree in kind with the original class template declaration ([dcl.type.elab]).</p>
</blockquote>
<h4 id="temp.mem">[temp.mem]</h4>
<p>Change paragraph 5:</p>
<blockquote>
<p><u>[<em>Note</em>: </u>A specialization of a conversion function template is referenced in the same way as a non-template conversion function that converts to the same type<u> ([class.conv.fct])</u>. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>] <s>[<em>Note</em>: </s>There is no syntax to form a <em>template-id</em> ([temp.names]) by providing an explicit template argument list ([temp.arg.explicit]) for a conversion function template<s> ([class.conv.fct])</s>. — <em>end note</em>]</p>
</blockquote>
<div class="del">
Remove paragraphs 6 through 8.
</div>
<h4 id="temp.friend">[temp.friend]</h4>
<p>Change paragraph 1:</p>
<blockquote>
<p>A friend of a class or class template can be a function template or class template, a specialization of a function template or class template, or a non-template function or class. <s>For a friend function declaration that is not a template declaration:</s></p>
<ol style="list-style-type: decimal">
<li><s>if the name of the friend is a qualified or unqualified <em>template-id</em>, the friend declaration refers to a specialization of a function template, otherwise,</s></li>
<li><s>if the name of the friend is a <em>qualified-id</em> and a matching non-template function is found in the specified class or namespace, the friend declaration refers to that function, otherwise,</s></li>
<li><s>if the name of the friend is a <em>qualified-id</em> and a matching function template is found in the specified class or namespace, the friend declaration refers to the deduced specialization of that function template ([temp.deduct.decl]), otherwise,</s></li>
<li><s>the name shall be an <em>unqualified-id</em> that declares (or redeclares) a non-template function.</s></li>
</ol>
<p>[<em>Example</em>:</p>
<p>[…] — <em>end example</em>]</p>
</blockquote>
<p>Move [temp.inject]/1 before paragraph 2 and change it:</p>
<blockquote>
<p>Friend classes<s> or</s><u>, class templates,</u> functions<u>, or function templates</u> can be declared within a class template. When a template is instantiated, <s>the names of </s>its friend<s>s</s><u> declarations</u> are treated as if the specialization had been explicitly declared at its point of instantiation. <u>[<em>Note</em>: They may introduce entities that belong to an enclosing namespace scope ([dcl.meaning]). — <em>end note</em>]</u></p>
</blockquote>
<div class="del">
Remove paragraph 5 (whose substance is incorporated in the above).
</div>
<h4 id="temp.class.spec">[temp.class.spec]</h4>
<p>Change paragraph 1:</p>
<blockquote>
<p>A <em>primary class template</em> declaration is one in which the <s>class template name</s><u><em>class-name</em></u> is an identifier. A template declaration in which the <s>class template name</s><u><em>class-name</em></u> is a <em>simple-template-id</em> is a <em>partial specialization</em> of the class template named in the <em>simple-template-id</em>. A partial specialization of a class template provides an alternative definition of the template that is used instead of the primary definition when the arguments in a specialization match those given in the partial specialization ([temp.class.spec.match]). <s>The</s><u>A declaration of the</u> primary template shall <s>be declared before</s><u>precede</u> any specialization<s>s</s> of that template. A partial specialization shall <s>be declared before the first</s><u>be reachable from any</u> use of a class template specialization that would make use of the partial specialization as the result of an implicit or explicit instantiation<s> in every translation unit in which such a use occurs</s>; no diagnostic is required.</p>
</blockquote>
<p>Change paragraph 2:</p>
<blockquote>
<p><u>Two partial specialization declarations declare the same entity if they are partial specializations of the same template and have equivalent <em>template-head</em>s and template argument lists ([temp.over.link]).</u> Each class template partial specialization is a distinct template and definitions shall be provided for the members of a template partial specialization ([temp.class.spec.mfunc]).</p>
</blockquote>
<p>Change paragraph 7:</p>
<blockquote>
<p>Partial specialization declarations <s>themselves are not found by name lookup</s><u>do not introduce a name</u>. <s>Rather</s><u>Instead</u>, when the primary template name is used, any <s>previously-declared</s><u>reachable</u> partial specializations of the primary template are also considered. One consequence is that a <em>using-declaration</em> which refers to a class template does not restrict the set of partial specializations which may be found through the <em>using-declaration</em>. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Insert before paragraph 8:</p>
<div class="ins">
<blockquote>
<p>A specialization of a class template partial specialization that has been declared but not defined is an incomplete type ([basic.types]).</p>
</blockquote>
</div>
<h5 id="temp.class.spec.mfunc">[temp.class.spec.mfunc]</h5>
<p>Change paragraph 1:</p>
<blockquote>
<p><s>The template parameter list of a member of a class template partial specialization shall match the template parameter list of the class template partial specialization. The template argument list of a member of a class template partial specialization shall match the template argument list of the class template partial specialization.</s> A class template partial specialization is a distinct template. The members of the class template partial specialization are unrelated to the members of the primary template. Class template partial specialization members that are used in a way that requires a definition shall be defined; the definitions of members of the primary template are never used as definitions for members of a class template partial specialization. An explicit specialization of a member of a class template partial specialization is declared in the same way as an explicit specialization of the primary template. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<h4 id="temp.over.link">[temp.over.link]</h4>
<p>Change paragraph 5, adding the first example from [over.dcl]/1:</p>
<blockquote>
<p>[…] For determining whether two dependent names ([temp.dep]) are equivalent, only the name itself is considered, not the result of name lookup<s> in the context of the template</s>. <u>[<em>Note</em>: </u>If <s>multiple declarations of the same function template differ in the result of this</s><u>such a dependent</u> name <s>lookup</s><u>is unqualified</u>, <s>the result for</s><u>it is looked up from</u> the first declaration <s>is used</s><u>of the function template ([temp.dep.candidate])</u>.<u> — <em>end note</em>]</u> […] [<em>Note</em>: For instance, one could have redundant parentheses. — <em>end note</em>] <u>[<em>Example</em>:</u></p>
<p><u>[…]</u></p>
<p><u>— <em>end example</em>]</u></p>
</blockquote>
<p>Change paragraph 7:</p>
<blockquote>
<p><s>Two function templates are <em>equivalent</em> if they are declared in the same scope, have the same name, have equivalent <em>template-head</em>⁠s, and have return types, parameter lists, and trailing <em>requires-clause</em>⁠s (if any) that are equivalent using the rules described above to compare expressions involving template parameters. Two function templates are <em>functionally equivalent</em> if they are declared in the same scope, have the same name, accept and are satisfied by the same set of template argument lists, and have return types and parameter lists that are functionally equivalent using the rules described above to compare expressions involving template parameters.</s> If the validity or meaning of the program depends on whether two constructs are equivalent, and they are functionally equivalent but not equivalent, the program is ill-formed, no diagnostic required.</p>
</blockquote>
<h3 id="temp.res">[temp.res]</h3>
<div class="del">
Replace paragraph 1:
</div>
<div class="ins">
<blockquote>
<p>A name that appears in a template declaration is looked up from where it appears in the first declaration of the template that contains it. If the name is <em>dependent</em> (as specified in [temp.dep]), it is looked up for each specialization (after substitution) because the lookup depends on a template parameter. [<em>Note</em>: Some dependent names are also looked up during parsing to determine that they are dependent or to interpret following <code>&lt;</code> tokens. Uses of other names might be type-dependent or value-dependent ([temp.dep.expr], [temp.dep.constexpr]). A <em>using-declarator</em> is never dependent in a specialization and is therefore replaced during lookup for that specialization ([basic.lookup]). — <em>end note</em>] [<em>Example</em>:</p>
<pre class="sourceCode cpp"><code class="sourceCode cpp"><span class="kw">struct</span> A {<span class="kw">operator</span> <span class="dt">int</span>();};
<span class="kw">template</span>&lt;<span class="kw">class</span> B,<span class="kw">class</span> T&gt;
<span class="kw">struct</span> D : B {
  T get() {<span class="kw">return</span> <span class="kw">operator</span> T();}     <span class="co">// conversion-function-id is dependent</span>
};
<span class="dt">int</span> f(D&lt;A,<span class="dt">int</span>&gt; d) {<span class="kw">return</span> d.get();}  <span class="co">// OK: lookup finds A::operator int</span></code></pre>
<p>— <em>end example</em>]</p>
</blockquote>
</div>
<p>Move the example from paragraph 10 and the second example from [temp.dep]/4 to the end of paragraph 1.</p>
<div class="del">
Replace paragraph 2 (but not the grammar following it):
</div>
<div class="ins">
<blockquote>
<p>If the validity or meaning of the program would be changed by considering a default argument or default template argument introduced in a declaration that is reachable from the point of instantiation of a specialization ([temp.point]) but is not found by lookup for the specialization, the program is ill-formed, no diagnostic required.</p>
</blockquote>
</div>
<p>Change paragraph 3:</p>
<blockquote>
<p><u>The component names of a <em>typename-specifier</em> are its <em>identifier</em> (if any) and those of its <em>nested-name-specifier</em> and <em>simple-template-id</em> (if any).</u> A <em>typename-specifier</em> denotes the type or class template denoted by the <em>simple-type-specifier</em> ([dcl.type.simple]) formed by omitting the keyword <code>typename</code>. <u>[<em>Note</em>: </u>The usual qualified name lookup ([basic.lookup.qual]) <s>is used to find the <em>qualified-id</em></s><u>applies</u> even in the presence of <code>typename</code>.<u> — <em>end note</em>]</u> [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<div class="del">
Remove paragraph 4.
</div>
<p>Change paragraph 5:</p>
<blockquote>
<p>A <s><em>qualified-id</em></s><u>qualified or unqualified name</u> is <s>assumed</s><u>said</u> to <s>name</s><u>be in</u> a type<u>-only context</u> if<u> it is the terminal name of</u></p>
<ol style="list-style-type: decimal">
<li><s>it is a qualified name in </s>a <s>type-id-only context (see below)</s><u><em>typename-specifier</em>, <em>nested-name-specifier</em>, <em>elaborated-type-specifier</em>, <em>class-or-decltype</em></u>, or</li>
<li><u>a <em>type-specifier</em> of a <em>new-type-id</em>, <em>defining-type-id</em>, <em>conversion-type-id</em>, <em>trailing-return-type</em>, default argument of a <em>type-parameter</em>, or <em>type-id</em> of a <code>static_cast</code>, <code>const_cast</code>, <code>reinterpret_cast</code>, or <code>dynamic_cast</code>, or</u></li>
<li><s>it is </s>a <em>decl-specifier</em> of the <em>decl-specifier-seq</em> of a
<ol style="list-style-type: decimal">
<li><em>simple-declaration</em> or a <em>function-definition</em> in namespace scope,</li>
<li><em>member-declaration</em>,</li>
<li><em>parameter-declaration</em> in a <em>member-declaration</em><sup>[…]</sup>, unless that <em>parameter-declaration</em> appears in a default argument,</li>
<li><em>parameter-declaration</em> in a <em>declarator</em> of a function or function template declaration whose <em>declarator-id</em> is qualified, unless that <em>parameter-declaration</em> appears in a default argument,</li>
<li><em>parameter-declaration</em> in a <em>lambda-declarator</em>, unless that <em>parameter-declaration</em> appears in a default argument, or</li>
<li><em>parameter-declaration</em> of a (non-type) <em>template-parameter</em>.</li>
</ol></li>
</ol>
<p><s>A qualified name is said to be in a <em>type-id-only context</em> if it appears in a <em>type-id</em>, <em>new-type-id</em>, or <em>defining-type-id</em> and the smallest enclosing <em>type-id</em>, <em>new-type-id</em>, or <em>defining-type-id</em> is a <em>new-type-id</em>, <em>defining-type-id</em>, <em>trailing-return-type</em>, default argument of a <em>type-parameter</em> of a template, or <em>type-id</em> of a <code>static_cast</code>, <code>const_cast</code>, <code>reinterpret_cast</code>, or <code>dynamic_cast</code>.</s> [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 6:</p>
<blockquote>
<p>A <em>qualified-id</em> <s>that refers to a member of an unknown specialization, that is not prefixed by <code>typename</code>, and</s><u>whose terminal name is dependent and</u> that is <s>not otherwise assumed to name</s><u>in</u> a type<u>-only context</u> <s>(see above)</s><u>is considered to</u> denote<s>s</s> a <s>non-</s>type. <u>A name that refers to a <em>using-declarator</em> whose terminal name is dependent is interpreted as a <em>typedef-name</em> if the <em>using-declarator</em> uses the keyword <code>typename</code>.</u> [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<div class="del">
Remove paragraph 7.
</div>
<p>Change paragraph 8:</p>
<blockquote>
[…] [<em>Example</em>:
<pre class="cpp">
int j;
template&lt;class T&gt; class X {
  void f(T t, int i, char* p) {
    t = i;          // diagnosed if X::f is instantiated, and the assignment to t is an error
    p = i;          // may be diagnosed even if X::f is not instantiated
    p = j;          // may be diagnosed even if X::f is not instantiated<u>
    X&lt;T&gt;::g(t);     // OK
    X&lt;T&gt;::h();      // may be diagnosed even if X::f is not instantiated</u>
  }
  void g(T t) {
    +;              // may be diagnosed even if X::g is not instantiated
  }
};

template&lt;class... T&gt; struct A {
  void operator++(int, T... t);                     // error: too many parameters
};
template&lt;class... T&gt; union X : T... { };            // error: union with base class
template&lt;class... T&gt; struct A : T...,  T... { };    // error: duplicate base class
</pre>
<p>— <em>end example</em>]</p>
</blockquote>
<div class="del">
Remove paragraphs 9 and 10 (whose example is moved to paragraph 1).
</div>
<h4 id="temp.local">[temp.local]</h4>
<p>Change paragraph 3:</p>
<blockquote>
The injected-class-name of a class template or class template specialization can be used as either a <em>template-name</em> or a <em>type-name</em> wherever it is <s>in scope</s><u>named</u>. [<em>Example</em>:
<pre class="cpp">
template &lt;class T&gt; struct Base {
  Base* p;
};

template &lt;class T&gt; struct Derived: public Base&lt;T&gt; {
  typename Derived::Base* p;            // meaning Derived::Base&lt;T&gt;
};

template&lt;class T, template&lt;class&gt; class U = T::<s>template </s>Base&gt; struct Third { };
Third&lt;Derived&lt;int&gt; &gt; t;                 // OK: default argument uses injected-class-name as a template
</pre>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 6:</p>
<blockquote>
The name of a <em>template-parameter</em> shall not be <s>redeclared within its</s><u>bound to any following declaration contained by the</u> scope <s>(including nested scopes)</s><u>to which the <em>template-parameter</em> belongs</u>. <s>A <em>template-parameter</em> shall not have the same name as the template name.</s> [<em>Example</em>:
<pre class="cpp">
template&lt;class T, int i&gt; class Y {
  int T;                                // error: template-parameter <s>redeclared</s><u>hidden</u>
  void f() {
    char T;                             // error: template-parameter <s>redeclared</s><u>hidden</u>
  }<u>
  friend void T();                      // OK: no name bound</u>
};

template&lt;class X&gt; class X;              // error: <u>hidden by </u>template-parameter<s> redeclared</s>
</pre>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 7:</p>
<blockquote>
<s>In the definition of a member</s><u>Unqualified name lookup considers the template parameter scope of a <em>template-declaration</em> before any scope that contains the template declared (even if it does not contain the <em>template-parameter-list</em>).<!-- non-nested, remote --> [<em>Note</em>: The scope</u> of a class template<s> that appears outside of the class template definition, the name of a member of the class template hides the name of a <em>template-parameter</em> of any enclosing class templates (but not a <em>template-parameter</em> of the member if the member is a class or function template)</s><u>, including its non-dependent base classes ([temp.dep.type], [class.member.lookup]), is searched before its template parameter scope</u>.<u> — <em>end note</em>]</u> [<em>Example</em>:
<pre class="cpp">
<u>struct B { };
namespace N {
  typedef void V;
  </u>template&lt;class T&gt; struct A <u>: B </u>{
<s>  struct B { /* ... */ };
</s><u>  </u>  typedef void C;
<u>  </u>  void f();
<u>  </u>  template&lt;class U&gt; void g(U);
<u>  </u>};
<u>}
</u>
template&lt;class <s>B</s><u>V</u>&gt; void <u>N::</u>A&lt;<s>B</s><u>V</u>&gt;::f() {
  <s>B</s><u>V</u> <s>b</s><u>v</u>;              // <s>A's B, not</s><u>V is</u> the template parameter<u>, not N::V</u>
}

template&lt;class B&gt; template&lt;class C&gt; void <u>N::</u>A&lt;B&gt;::g(C) {
  B b;              // <s>A's B</s><u>the base class</u>, not the template parameter
  C c;              // the template parameter C, not A's C
}
</pre>
<p>— <em>end example</em>]</p>
</blockquote>
<div class="del">
Remove paragraphs 8 and 9 (whose examples are merged into the above).
</div>
<h4 id="temp.dep">[temp.dep]</h4>
<p>Change paragraph 2:</p>
<blockquote>
<p><s>In</s><u>A <em>dependent call</em> is</u> an expression<u>, possibly formed as a non-member candidate for an operator ([over.match.oper]),</u> of the form:</p>
<blockquote>
<p><em>postfix-expression</em> <code>(</code> <em>expression-list</em><sub><em>opt</em></sub> <code>)</code></p>
</blockquote>
<p>where the <em>postfix-expression</em> is an <em>unqualified-id</em><s>, the <em>unqualified-id</em> denotes a <em>dependent name</em> if</s><u> and</u></p>
<ol style="list-style-type: decimal">
<li>any of the expressions in the <em>expression-list</em> is a pack expansion ([temp.variadic]),</li>
<li>any of the expressions or <em>braced-init-list</em>⁠s in the <em>expression-list</em> is type-dependent ([temp.dep.expr]), or</li>
<li>the <em>unqualified-id</em> is a <em>template-id</em> in which any of the template arguments depends on a template parameter.</li>
</ol>
<p><s>If an operand of an operator is a type-dependent expression, the operator also denotes a dependent name.</s> <u>The component name of an <em>unqualified-id</em> is dependent if</u></p>
<ol style="list-style-type: decimal">
<li><u>it is a <em>conversion-function-id</em> whose <em>conversion-type-id</em> is dependent, or</u></li>
<li><u>it is <code>operator=</code> and the current class is a templated entity, or</u></li>
<li><u>the <em>unqualified-id</em> is the <em>postfix-expression</em> in a dependent call.</u></li>
</ol>
<p>[<em>Note</em>: Such names <s>are unbound and </s>are looked up <u>only </u>at the point of the template instantiation ([temp.point]) in both the context of the template definition and the context of the point of instantiation ([temp.dep.candidate]). — <em>end note</em>]</p>
</blockquote>
<div class="del">
Remove paragraph 4 (whose example is moved to [temp.res]/1).
</div>
<h5 id="temp.dep.type">[temp.dep.type]</h5>
<p>Change paragraph 1:</p>
<blockquote>
<p>A name<u> or <em>template-id</em></u> refers to the <em>current instantiation</em> if it is</p>
<ol style="list-style-type: decimal">
<li>in the definition of a class template, a nested class of a class template, a member of a class template, or a member of a nested class of a class template, the injected-class-name ([class.pre]) of the class template or nested class,</li>
<li>in the definition of a primary class template or a member of a primary class template, the name of the class template followed by the template argument list of <s>the primary template</s><u>its <em>template-head</em></u> (<s>as described below</s><u>[temp.arg]</u>) enclosed in <code>&lt;&gt;</code> (or an equivalent template alias specialization),</li>
</ol>
<p>[…]</p>
</blockquote>
<div class="del">
Remove paragraph 2 (adapted in [temp.arg]).
</div>
<p>Change paragraph 5:</p>
<blockquote>
<p>A <u>qualified ([basic.lookup.qual]) or unqualified </u>name is a <em>member of the current instantiation</em> if<s> it is</s></p>
<ol style="list-style-type: decimal">
<li><u>its lookup context, if it is a qualified name, is the current instantiation, and</u></li>
<li><s>An unqualified name that, when looked up, refers to at least one</s><u>lookup for it finds any</u> member of a class that is the current instantiation<s> or a non-dependent base class thereof</s>. <s>[<em>Note</em>: This can only occur when looking up a name in a scope enclosed by the definition of a class template. — <em>end note</em>]</s></li>
<li><s>A <em>qualified-id</em> in which the <em>nested-name-specifier</em> refers to the current instantiation and that, when looked up, refers to at least one member of a class that is the current instantiation or a non-dependent base class thereof. [<em>Note</em>: If no such member is found, and the current instantiation has any dependent base classes, then the <em>qualified-id</em> is a member of an unknown specialization; see below. — <em>end note</em>]</s></li>
<li><s>An <em>id-expression</em> denoting the member in a class member access expression ([expr.ref]) for which the type of the object expression is the current instantiation, and the <em>id-expression</em>, when looked up ([basic.lookup.classref]), refers to at least one member of a class that is the current instantiation or a non-dependent base class thereof. [<em>Note</em>: If no such member is found, and the current instantiation has any dependent base classes, then the <em>id-expression</em> is a member of an unknown specialization; see below. — <em>end note</em>]</s></li>
</ol>
<p>[<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
<p>A <u>qualified or unqualified </u>name <s>is</s><u>names</u> a <em>dependent member of the current instantiation</em> if it is a member of the current instantiation that, when looked up, refers to at least one member<u> declaration (including a <em>using-declarator</em> whose terminal name is dependent)</u> of a class that is the current instantiation.</p>
</blockquote>
<p>Change paragraph 6:</p>
<blockquote>
<p>A <u>qualified </u>name<u> ([basic.lookup.qual])</u> is <s>a <em>member of an unknown specialization</em></s><u>dependent</u> if it is</p>
<ol style="list-style-type: decimal">
<li><u>it is a <em>conversion-function-id</em> whose <em>conversion-type-id</em> is dependent, or</u></li>
<li><s>A <em>qualified-id</em> in which the <em>nested-name-specifier</em> names</s><u>its lookup context</u> is <s>a </s>dependent <s>type that</s><u>and</u> is not the current instantiation<s>.</s><u>, or</u></li>
<li><u>its lookup context is the current instantiation and it is <code>operator=</code>[<em>Footnote</em>: Every instantiation of a class template declares a different set of assignment operators. — <em>end footnote</em>], or</u></li>
<li><s>A <em>qualified-id</em> in which the <em>nested-name-specifier</em> refers to</s><u>its lookup context is</u> the current instantiation<s>, the current instantiation</s><u> and</u> has at least one dependent base class, and qualified name lookup <s>of</s><u>for</u> the <s><em>qualified-id</em></s><u>name</u> <s>does not </s>find<u>s nothing ([basic.lookup.qual])</u><s> any member of a class that is the current instantiation or a non-dependent base class thereof</s>.</li>
<li><s>[…]</s> <u>[<em>Example</em>:</u></li>
</ol>
<pre class="sourceCode cpp ins"><code class="sourceCode cpp"><span class="kw">struct</span> A {
  <span class="kw">using</span> B=<span class="dt">int</span>;
  A f();
};
<span class="kw">struct</span> C : A {};
<span class="kw">template</span>&lt;<span class="kw">class</span> T&gt;
<span class="dt">void</span> g(T t) {
  <span class="kw">decltype</span>(t.A::f())::B i;  <span class="co">// error: typename needed to interpret B as a type</span>
}
<span class="kw">template</span> <span class="dt">void</span> g(C);         <span class="co">// ...even though A is ::A here</span></code></pre>
<p><u>— <em>end example</em>]</u></p>
</blockquote>
<div class="del">
Remove paragraph 7 (part of whose example is added to that in [temp.res]/8).
</div>
<p>Change paragraph 8:</p>
<blockquote>
<p>If, for a given set of template arguments, a specialization of a template is instantiated that refers to a member of the current instantiation with a <s><em>qualified-id</em> or class member access expression</s><u>qualified name</u>, the name<s> in the <em>qualified-id</em> or class member access expression</s> is looked up in the template instantiation context. If the result of this lookup differs from the result of name lookup in the template definition context, name lookup is ambiguous. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 9:</p>
<blockquote>
<p>A type is dependent if it is</p>
<ol style="list-style-type: decimal">
<li>a template parameter,</li>
<li><u>denoted by </u>a <s>member of an unknown specialization</s><u>dependent (qualified) name</u>,</li>
<li>a nested class or enumeration that is a <s>dependent</s><u>direct</u> member of <u>a class that is </u>the current instantiation,</li>
<li>a cv-qualified type where the cv-unqualified type is dependent,</li>
<li>a compound type constructed from any dependent type,</li>
<li>an array type whose element type is dependent or whose bound (if any) is value-dependent,</li>
<li>a function type whose exception specification is value-dependent,</li>
<li>denoted by a <em>simple-template-id</em> in which either the template name is a template parameter or any of the template arguments is a dependent type or an expression that is type-dependent or value-dependent or is a pack expansion [<em>Note</em>: This includes an injected-class-name ([class.pre]) of a class template used without a <em>template-argument-list</em>. — <em>end note</em>], or</li>
<li>denoted by <code>decltype(</code><em>expression</em><code>)</code>, where <em>expression</em> is type-dependent ([temp.dep.expr]).</li>
</ol>
</blockquote>
<h5 id="temp.dep.expr">[temp.dep.expr]</h5>
<p>Change paragraph 2:</p>
<blockquote>
<p><code>this</code> is type-dependent if the <u>current </u>class<s> type of the enclosing member function</s><u> ([expr.prim.this])</u> is dependent ([temp.dep.type]).</p>
</blockquote>
<p>Change paragraph 3:</p>
<blockquote>
<p>An <em>id-expression</em> is type-dependent if it is <u>a <em>template-id</em> that is </u>not a concept-id and <s>it contains</s><u>is dependent; or if its terminal name is</u></p>
<ol style="list-style-type: decimal">
<li><s>an <em>identifier</em> </s>associated by name lookup with one or more declarations declared with a dependent type,</li>
<li><s>an <em>identifier</em> </s>associated by name lookup with a non-type <em>template-parameter</em> declared with a type that contains a placeholder type ([dcl.spec.auto]),</li>
<li><s>an <em>identifier</em> </s>associated by name lookup with a variable declared with a type that contains a placeholder type ([dcl.spec.auto]) where the initializer is type-dependent,</li>
<li><s>an <em>identifier</em> </s>associated by name lookup with one or more declarations of member functions of <u>a class that is </u>the current instantiation declared with a return type that contains a placeholder type,</li>
<li><s>an <em>identifier</em> </s>associated by name lookup with a structured binding declaration ([dcl.struct.bind]) whose <em>brace-or-equal-initializer</em> is type-dependent,</li>
<li>the <em>identifier</em> <code>__func__</code> ([dcl.fct.def.general]), where any enclosing function is a template, a member of a class template, or a generic lambda,</li>
<li><s>a <em>template-id</em> that is dependent,</s></li>
<li>a <em>conversion-function-id</em> that specifies a dependent type, or</li>
<li><s>a <em>nested-name-specifier</em> or a <em>qualified-id</em> that names a member of an unknown specialization</s><u>dependent</u>;</li>
</ol>
<p>or if it names a dependent member of the current instantiation that is a static data member of type “array of unknown bound of <code>T</code>” for some <code>T</code> ([temp.static]). Expressions of the following forms are type-dependent only if the type specified by the <em>type-id</em>, <em>simple-type-specifier</em> or <em>new-type-id</em> is dependent, even if any subexpression is type-dependent:</p>
<blockquote>
<p>[…]</p>
</blockquote>
</blockquote>
<p>Change paragraph 5:</p>
<blockquote>
<p>A class member access expression ([expr.ref]) is type-dependent if <u>the terminal name of its <em>id-expression</em>, if any, is dependent or </u>the expression refers to a member of the current instantiation and the type of the referenced member is dependent<s>, or the class member access expression refers to a member of an unknown specialization</s>. [<em>Note</em>: In an expression of the form <code>x.y</code> or <code>xp-&gt;y</code> the type of the expression is usually the type of the member <code>y</code> of the class of <code>x</code> (or the class pointed to by <code>xp</code>). However, if <code>x</code> or <code>xp</code> refers to a dependent type that is not the current instantiation, the type of <code>y</code> is always dependent. <s>If <code>x</code> or <code>xp</code> refers to a non-dependent type or refers to the current instantiation, the type of <code>y</code> is the type of the class member access expression.</s> — <em>end note</em>]</p>
</blockquote>
<h5 id="temp.dep.temp">[temp.dep.temp]</h5>
<p>Change paragraph 4:</p>
<blockquote>
<p>A template <em>template-argument</em> is dependent if it names a <em>template-parameter</em> or <u>its terminal name </u>is <s>a <em>qualified-id</em> that refers to a member of an unknown specialization</s><u>dependent</u>.</p>
</blockquote>
<div class="del">
<h4>[temp.nondep]</h4>
</div>
<p>Remove subclause, referring the stable name to [temp.res]. Remove the cross reference in [basic.def.odr]/14. Update the one surviving cross reference (in [basic.link]/13.3) to refer to [temp.res].</p>
<h4 id="temp.dep.candidate">[temp.dep.candidate]</h4>
<p>Change paragraph 1:</p>
<blockquote>
<p><s>For a function call where the <em>postfix-expression</em> is a dependent name, the candidate functions are found using the usual lookup rules from the template definition context ([basic.lookup.unqual], [basic.lookup.argdep]). [<em>Note</em>: For the part of the lookup using associated namespaces ([basic.lookup.argdep]), function declarations found in the template instantiation context are found by this lookup, as described in [basic.lookup.argdep]. — <em>end note</em>]</s> If <s>the</s><u>a dependent</u> call<u> ([temp.dep])</u> would be ill-formed or would find a better match had the lookup <s>within the associated namespaces</s><u>for its dependent name</u> considered all the function declarations with external linkage introduced in <s>those</s><u>the associated</u> namespaces in all translation units, not just considering those declarations found in the template definition and template instantiation contexts<u> ([basic.lookup.argdep])</u>, then the program <s>has undefined behavior</s><u>is ill-formed, no diagnostic required</u>.</p>
</blockquote>
<div class="del">
<h4>[temp.inject]</h4>
</div>
<p>Remove subclause, referring the stable name (which has no surviving cross references) to [temp.friend]. Paragraph 1 is adapted in [temp.friend].</p>
<h3 id="temp.spec">[temp.spec]</h3>
<p>Change paragraph 3:</p>
<blockquote>
<p>An explicit specialization may be declared for a function template, a variable template, a class template, a member of a class template, or a member template. An explicit specialization declaration is introduced by <code>template&lt;&gt;</code>. In an explicit specialization declaration for a variable template, a class template, a member of a class template<u>,</u> or a class member template, <s>the name of </s>the variable or class that is explicitly specialized shall be <u>specified with </u>a <em>simple-template-id</em>. In the explicit specialization declaration for a function template or a member function template, <s>the name of </s>the function or member function explicitly specialized may be <u>specified using </u>a <em>template-id</em>. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<h4 id="temp.inst">[temp.inst]</h4>
<div class="del">
Remove paragraph 12.
</div>
<h4 id="temp.explicit">[temp.explicit]</h4>
<p>Change paragraph 4:</p>
<blockquote>
<p>If the explicit instantiation is for a class or member class, the <em>elaborated-type-specifier</em> in the <em>declaration</em> shall include a <em>simple-template-id</em>; otherwise, the <em>declaration</em> shall be a <em>simple-declaration</em> whose <em>init-declarator-list</em> comprises a single <em>init-declarator</em> that does not have an <em>initializer</em>. <s>If the explicit instantiation is for a function or member function, the <em>unqualified-id</em> in the <em>declarator</em> shall be either a <em>template-id</em> or, where all template arguments can be deduced, a <em>template-name</em> or <em>operator-function-id</em>. [<em>Note</em>: The declaration may declare a <em>qualified-id</em>, in which case the <em>unqualified-id</em> of the <em>qualified-id</em> must be a <em>template-id</em>. — <em>end note</em>] If the explicit instantiation is for a member function, a member class or a static data member of a class template specialization, the name of the class template specialization in the <em>qualified-id</em> for the member name shall be a <em>simple-template-id</em>.</s> If the explicit instantiation is for a variable template specialization, the <em>unqualified-id</em> in the <em>declarator</em> shall be a <em>simple-template-id</em>. <s>An explicit instantiation shall appear in an enclosing namespace of its template. If the name declared in the explicit instantiation is an unqualified name, the explicit instantiation shall appear in the namespace where its template is declared or, if that namespace is inline ([namespace.def]), any namespace from its enclosing namespace set. [<em>Note</em>: Regarding qualified names in declarators, see [dcl.meaning]. — <em>end note</em>]</s> [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 5:</p>
<blockquote>
<p><u>An explicit instantiation does not introduce a name ([basic.scope.scope]).</u> A declaration of a function template, a variable template, a member function or static data member of a class template, or a member function template of a class or class template shall <s>precede</s><u>be reachable from</u> an<u>y</u> explicit instantiation of that entity. A definition of a class template, a member class of a class template, or a member class template of a class or class template shall <s>precede</s><u>be reachable from</u> an<u>y</u> explicit instantiation of that entity unless <s>the explicit instantiation is preceded by </s>an explicit specialization of the entity with the same template arguments<u> is reachable therefrom</u>. If the <em>declaration</em> of the explicit instantiation names an implicitly-declared special member function ([special]), the program is ill-formed.</p>
</blockquote>
<div class="del">
Remove paragraph 8.
</div>
<p>Change paragraph 9:</p>
<blockquote>
<p>A trailing <em>template-argument</em> can be left unspecified in an explicit instantiation of a function template specialization or of a member function template specialization provided it can be deduced<s> from the type of a function parameter</s> ([temp.deduct<u>.decl</u>]). <u>If all template arguments can be deduced, the empty template argument list <code>&lt;&gt;</code> may be omitted.</u> [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 11:</p>
<blockquote>
<p>An explicit instantiation that names a class template specialization is also an explicit instantiation of the same kind (declaration or definition) of each of its <u>direct non-template </u>members<s> (not including members inherited from base classes and members that are templates)</s> that has not been previously explicitly specialized in the translation unit containing the explicit instantiation, provided that the associated constraints, if any, of that member are satisfied by the template arguments of the explicit instantiation ([temp.constr.decl], [temp.constr.constr]), except as described below. [<em>Note</em>: In addition, it will typically be an explicit instantiation of certain implementation-dependent data about the class. — <em>end note</em>]</p>
</blockquote>
<h4 id="temp.expl.spec">[temp.expl.spec]</h4>
<p>Change paragraph 4:</p>
<blockquote>
<p><u>An explicit specialization does not introduce a name ([basic.scope.scope]).</u> A declaration of a function template, class template, or variable template being explicitly specialized shall <s>precede</s><u>be reachable from</u> the declaration of the explicit specialization. [<em>Note</em>: A declaration, but not a definition of the template is required. — <em>end note</em>] The definition of a class or class template shall <s>precede</s><u>be reachable from</u> the declaration of an explicit specialization for a member template of the class or class template. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<p>Change paragraph 5:</p>
<blockquote>
<p>A member function, a member function template, a member class, a member enumeration, a member class template, a static data member, or a static data member template of a class template may be explicitly specialized for a class specialization that is implicitly instantiated; in this case, the definition of the class template shall <s>precede</s><u>be reachable from</u> the explicit specialization for the member of the class template. If such an explicit specialization for the member of a class template names an implicitly-declared special member function ([special]), the program is ill-formed.</p>
</blockquote>
<div class="del">
Remove paragraph 9.
</div>
<p>Change paragraph 11:</p>
<blockquote>
<p>A trailing <em>template-argument</em> can be left unspecified in the <em>template-id</em> naming an explicit function template specialization provided it can be deduced<s> from the function argument type</s><u> ([temp.deduct.decl])</u>. [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<h3 id="temp.fct.spec">[temp.fct.spec]</h3>
<h4 id="temp.arg.explicit">[temp.arg.explicit]</h4>
<p>Change paragraph 4:</p>
<blockquote>
<p>Trailing template arguments that can be deduced ([temp.deduct]) or obtained from default <em>template-argument</em>⁠s may be omitted from the list of explicit <em>template-argument</em>⁠s. <u>[<em>Note</em>: </u>A trailing template parameter pack ([temp.variadic]) not otherwise deduced will be deduced as an empty sequence of template arguments.<u> — <em>end note</em>]</u> If all of the template arguments can be deduced, they may all be omitted; in this case, the empty template argument list <code>&lt;&gt;</code> itself may also be omitted. <s>In contexts where deduction is done and fails, or in contexts where deduction is not done, if a template argument list is specified and it, along with any default template arguments, identifies a single function template specialization, then the <em>template-id</em> is an lvalue for the function template specialization.</s> [<em>Example</em>:</p>
<p>[…]</p>
<p>— <em>end example</em>]</p>
</blockquote>
<h4 id="temp.deduct">[temp.deduct]</h4>
<p>Change example in bullet (11.4):</p>
<blockquote>
[<em>Example</em>:
<pre class="cpp">
template &lt;int I&gt; struct X { };
template &lt;template &lt;class T&gt; class&gt; struct Z { };
template &lt;class T&gt; void f(typename T::Y*){}
template &lt;class T&gt; void g(X&lt;T::N&gt;*){}
template &lt;class T&gt; void h(Z&lt;T::<s>template </s>TT&gt;*){}
struct A {};
struct B { int Y; };
struct C {
  typedef int N;
};
struct D {
  typedef int TT;
};

int main() {
  // Deduction fails in each of these cases:
  f&lt;A&gt;(0);          // A does not contain a member Y
  f&lt;B&gt;(0);          // The Y member of B is not a type
  g&lt;C&gt;(0);          // The N member of C is not a non-type
  h&lt;D&gt;(0);          // The TT member of D is not a template
}
</pre>
<p>— <em>end example</em>]</p>
</blockquote>
<h5 id="temp.deduct.conv">[temp.deduct.conv]</h5>
<p>Change paragraph 1:</p>
<blockquote>
<p>Template argument deduction is done by comparing the return type of the conversion function template (call it <code>P</code>) with the type <s>that is required as the result</s><u>specified by the <em>conversion-type-id</em></u> of the <s>conversion</s><u><em>conversion-function-id</em> being looked up</u> (call it <code>A</code><s>; see [dcl.init], [over.match.conv], and [over.match.ref] for the determination of that type</s>) as described in [temp.deduct.type]. <u>If the <em>conversion-function-id</em> is constructed during overload resolution ([over.match.funcs]), the following transformations apply.</u></p>
</blockquote>
<p>Change paragraph 5:</p>
<blockquote>
<p>In general, the deduction process attempts to find template argument values that will make the deduced <code>A</code> identical to <code>A</code>. However, <s>there are four cases that allow a difference</s><u>certain attributes of <code>A</code> may be ignored</u>:</p>
<ol style="list-style-type: decimal">
<li>If the original <code>A</code> is a reference type, <u>any cv-qualifiers of </u><code>A</code><s> can be more cv-qualified than the deduced <code>A</code></s> (i.e., the type referred to by the reference).</li>
<li>If the original <code>A</code> is a function pointer<u> or pointer-to-member-function</u> type, <s><code>A</code> can be “pointer to function” even if the deduced <code>A</code> is “pointer to </s><u>its </u><code>noexcept</code><s> function”</s>.</li>
<li><s>If the original <code>A</code> is a pointer-to-member-function type, <code>A</code> can be “pointer to member of type function” even if the deduced <code>A</code> is “pointer to member of type <code>noexcept</code> function”.</s></li>
<li><s>The deduced</s><u>Any cv-qualifiers in</u> <code>A</code> <s>can be another pointer or pointer-to-member type </s>that can be <s>converted to <code>A</code> via</s><u>restored by</u> a qualification conversion.</li>
</ol>
</blockquote>
<p>Change paragraph 6:</p>
<blockquote>
<p>These <s>alternatives</s><u>attributes</u> are <s>considered</s><u>ignored</u> only if type deduction would otherwise fail. If <s>they yield</s><u>ignoring them allows</u> more than one possible deduced <code>A</code>, the type deduction fails.</p>
</blockquote>
<h4 id="temp.over">[temp.over]</h4>
<p>Change paragraph 1:</p>
<blockquote>
<p>When a call <s>to the name </s>of a function or function template is written (explicitly, or implicitly using the operator notation), template argument deduction ([temp.deduct]) and checking of any explicit template arguments ([temp.arg]) are performed for each function template to find the template argument values (if any) that can be used with that function template to instantiate a function template specialization that can be invoked with the call arguments<u> or, for conversion function templates, that can convert to the required type</u>. For each function template, if the argument deduction and checking succeeds, the <em>template-argument</em>⁠s (deduced and/or explicit) are used to synthesize the declaration of a single function template specialization which is added to the candidate functions set to be used in overload resolution. If, for a given function template, argument deduction fails or the synthesized function template specialization would be ill-formed, no such function is added to the set of candidate functions for that template. The complete set of candidate functions includes all the synthesized declarations and all of the non-template <s>overloaded </s>functions <s>of the same name</s><u>found by name lookup</u>. The synthesized declarations are treated like any other functions in the remainder of overload resolution, except as explicitly noted in [over.match.best].<sup>[…]</sup></p>
</blockquote>
<h2 id="except">[except]</h2>
<h3 id="except.handle">[except.handle]</h3>
<div class="del">
Remove paragraph 11.
</div>
<p>Change paragraph 12:</p>
<blockquote>
<p>Exceptions thrown in destructors of objects with static storage duration or in constructors of <s>namespace-scope </s>objects <u>associated with non-block variables </u>with static storage duration are not caught by a <em>function-try-block</em> on the <code>main</code> function ([basic.start.main]). Exceptions thrown in destructors of objects with thread storage duration or in constructors of <s>namespace-scope </s>objects <u>associated with non-block variables </u>with thread storage duration are not caught by a <em>function-try-block</em> on the initial function of the thread.</p>
</blockquote>
<h3 id="except.terminate">[except.terminate]</h3>
<p>Change bullet (1.5):</p>
<blockquote>
<p>when initialization of a non-<s>local</s><u>block</u> variable with static or thread storage duration ([basic.start.dynamic]) exits via an exception, or</p>
</blockquote>
<h2 id="concept.booleantestable">[concept.booleantestable]</h2>
<p>Change paragraph 2:</p>
<blockquote>
<p>Let <code>e</code> be an expression such that <code>decltype((e))</code> is <code>T</code>. <code>T</code> models <em><code>boolean-testable-impl</code></em> only if:</p>
<ol style="list-style-type: decimal">
<li>either <code>remove_cvref_t&lt;T&gt;</code> is not a class type, or <s>name lookup</s><u>a search</u> for the names <code>operator&amp;&amp;</code> and <code>operator||</code> <s>with</s>in the scope of <code>remove_cvref_t&lt;T&gt;</code> <s>as if by class member access lookup ([class.member.lookup]) results in an empty declaration set</s><u>finds nothing</u>; and</li>
<li><s>name</s><u>argument-dependent</u> lookup<u> ([basic.lookup.argdep])</u> for the names <code>operator&amp;&amp;</code> and <code>operator||</code> <s>in the associated namespaces and entities of</s><u>with</u> <code>T</code><s> ([basic.lookup.argdep])</s><u> as the only argument type</u> finds no disqualifying declaration (defined below).</li>
</ol>
</blockquote>
<p>Change bullet (5.2.3):</p>
<blockquote>
<p>the declaration declares a function template <s>that is not visible in its namespace</s><u>to which no name is bound</u> ([<s>namespace.memdef</s><u>dcl.meaning</u>]).</p>
</blockquote>
<h2 id="diff.basic">[diff.basic]</h2>
<p>Change paragraph 2 (the example is based on that from the removed [class.nested.type]):</p>
<blockquote>
<p><strong>Affected subclause:</strong> [basic.scope]<br /><strong>Change:</strong> A <code>struct</code> is a scope in C++, not in C.<br /><u>For example,</u></p>
<pre class="sourceCode cpp ins"><code class="sourceCode cpp"><span class="kw">struct</span> X {
  <span class="kw">struct</span> Y { <span class="dt">int</span> a; } b;
};
<span class="kw">struct</span> Y c;</code></pre>
<p><u>is valid in C but not in C++, which would require <code>X::Y c;</code>.</u><br /><strong>Rationale:</strong> Class scope is crucial to C++, and a struct is a class.<br /><strong>Effect on original feature:</strong> Change to semantics of well-defined feature.<br /><strong>Difficulty of converting:</strong> Semantic transformation.<br /><strong>How widely used:</strong> C programs use <code>struct</code> extremely frequently, but the change is only noticeable when <code>struct</code>, enumeration, or enumerator names are referred to outside the <code>struct</code>. The latter is probably rare.</p>
</blockquote>
<div class="ins">
<h2>[depr.template.template]</h2>
<p>Add this subclause before [depr.c.headers]:</p>
<blockquote>
<p>The use of the keyword <code>template</code> before the qualified name of a class or alias template without a template argument list is deprecated.</p>
</blockquote>
</div>
<h1 id="acknowledgments">Acknowledgments</h1>
<p>Thanks to Richard Smith for helping discover and interpret several of the issues addressed and for feedback on their resolutions, and to Rachel Ertl for helping decide on them.</p>
</body>
</html>
