Movatterモバイル変換


[0]ホーム

URL:


Issue 159 - WG21 CWG Issues
Title
Namespace qualification in declarators
Status
tc1
Section
9.3.4 [dcl.meaning]
Submitter
John Spicer

Created on1999-08-23.00:00:00 last changed277 months ago

Messages

msg445 (view)
Date: 2000-10-15.00:00:00

Proposed resolution (10/00):

Remove the last sentence of9.3.4 [dcl.meaning] paragraph 1 (cited above) and the examplethat follows.

msg333 (view)
Date: 2000-04-15.00:00:00

Notes from 04/00 meeting:

There was some question as to whether this issue actuallyconstituted a defect in the Standard. John Spicer suggested thatmachine-generated source code would be likely to run afoul of thisprohibition. Francis Glassborow expressed support for a rule thatwould allow full qualification, or qualification relative to thenamespace containing the definition, but not qualification relative toa containing namespace. There was no consensus for moving forwardwith a DR at this point, so the issue was left in "review" status.

msg132 (view)
Date: 2003-04-25.00:00:00

9.3.4 [dcl.meaning] paragraph 1says:

In the qualifieddeclarator-id for a class or namespace memberdefinition that appears outside of the member's class or namespace,thenested-name-specifier shall not name any of the namespaces thatenclose the member's definition.
This results in the following behavior:
    namespace N {        namespace M {            void f();            void g();        }        void M::f(){}     // okay        void N::M::g(){}  // error    }
I was very surprised when this rule was pointed out to me. The changeappears to have been introduced around the time of the first SantaCruz meeting, but I don't recall discussion of it and could not find amotion related to it.

Regardless of where it came from, I also can't understand why it is there.Certainly it shouldn't matterhow you name a given class or namespace.

For example, the standard permits:

    namespace N {        namespace M {            void f();            void g();        }        namespace X = M;        namespace Y = N::M;        void X::f(){}  // okay        void Y::g(){}  // okay    }
So, it is okay to use an alias forN::M,but not to useN::M directly.Note that itis okay to useN::Min any other context at this pointin the program (i.e., the rule is a specific restriction on declaratornames, not a general rule on the use of qualified names).

Does anyone recall the intent of this rule or any rationale for itsexistence?

History
DateUserActionArgs
2003-04-25 00:00:00adminsetstatus: dr -> tc1
2000-11-18 00:00:00adminsetmessages: +msg445
2000-11-18 00:00:00adminsetstatus: review -> dr
2000-05-21 00:00:00adminsetmessages: +msg333
2000-05-21 00:00:00adminsetstatus: drafting -> review
2000-02-23 00:00:00adminsetstatus: open -> drafting
1999-08-23 00:00:00admincreate

[8]ページ先頭

©2009-2026 Movatter.jp