Movatterモバイル変換


[0]ホーム

URL:


Issue 1838 - WG21 CWG Issues
Title
Definition via unqualified-id and using-declaration
Status
cd4
Section
_N4868_.9.8.2.3 [namespace.memdef]
Submitter
Richard Smith

Created on2014-01-17.00:00:00 last changed109 months ago

Messages

msg5370 (view)
Date: 2014-11-15.00:00:00

[Moved to DR at the November, 2014 meeting.]

msg5137 (view)
Date: 2014-07-15.00:00:00

Proposed Resolution (July, 2014):

  1. Change _N4868_.9.8.2.3 [namespace.memdef] paragraph 1 as follows:

  2. Members (including explicit specializations of templates(13.9.4 [temp.expl.spec])) of a namespace can be definedwithin that namespace.A declaration in a namespaceN (excluding declarations in nested scopes) whosedeclarator-id is anunqualified-id declares (orredeclares) a member ofN, and may be a definition.[Note: An explicit instantiation (13.9.3 [temp.explicit])or explicit specialization (13.9.4 [temp.expl.spec]) of atemplate does not introduce a name and thus may be declaredusing anunqualified-id in a member of the enclosingnamespace set, if the primary template is declared in an inlinenamespace. —end note] [Example:

      namespace X {    void f() { /* ... */ }// OK: introducesX::f()    namespace M {      void g();             // OK: introducesX::M::g()    }    using M::g;    void g();               // error: conflicts withX::M::g()  }

    end example]

  3. Change _N4868_.9.8.2.3 [namespace.memdef] paragraph 3 as follows:

  4. Every name first declared in a namespace is a member of thatnamespace. If afriend declaration...

This resolution also resolves issues1021and987.

msg4880 (view)
Date: 2014-02-15.00:00:00

Notes from the February, 2014 meeting:

CWG agreed that the definition in such cases is a member of theouter namespace, not a redeclaration of the name introduced in thatnamespace by theusing-declaration.

msg4879 (view)
Date: 2014-01-17.00:00:00

The Standard is not clear about what happens when an entity isdeclared but not defined in an inner namespace and declared via ausing-declaration in an outer namespace, and a definition of anentity with that name as anunqualified-id appears in the outernamespace. Is this a legitimate definition of the inner-namespace entity,as it would be if the definition used aqualified-id, or is thedefinition a member of the outer namespace and thus in conflict withtheusing-declaration? There is implementation divergence onthe treatment of such definitions.

See also issues1708 and1021.

History
DateUserActionArgs
2017-02-06 00:00:00adminsetstatus: drwp -> cd4
2015-05-25 00:00:00adminsetstatus: dr -> drwp
2015-04-13 00:00:00adminsetmessages: +msg5370
2014-11-24 00:00:00adminsetstatus: tentatively ready -> dr
2014-10-13 00:00:00adminsetmessages: +msg5137
2014-10-13 00:00:00adminsetstatus: drafting -> tentatively ready
2014-03-03 00:00:00adminsetmessages: +msg4880
2014-01-17 00:00:00admincreate

[8]ページ先頭

©2009-2026 Movatter.jp