Title
Visibility of names after using-directives
Status
nad
Section
6.5.3 [basic.lookup.unqual]
Submitter
Jörg Barfurth

Created on 2000-05-31.00:00:00 last changed 33 months ago

Messages

Date: 2002-04-15.00:00:00

Notes from the 4/02 meeting:

After a lot of discussion of possible wording changes, we decided the wording should be left alone. 6.5.3 [basic.lookup.unqual] paragraph 2 is not intended to be a full specification; that's in 9.8.4 [namespace.udir] paragraph 1. See also 6.4.6 [basic.scope.namespace] paragraph 1.

Date: 2002-04-15.00:00:00

Notes from the 4/02 meeting:

After a lot of discussion of possible wording changes, we decided the wording should be left alone. 6.5.3 [basic.lookup.unqual] paragraph 2 is not intended to be a full specification; that's in 9.8.4 [namespace.udir] paragraph 1. See also 6.4.6 [basic.scope.namespace] paragraph 1.

Date: 2022-11-20.07:54:16

The wording of 6.5.3 [basic.lookup.unqual] paragraph 2 is misleading. It says:

The declarations from the namespace nominated by a using-directive become visible in a namespace enclosing the using-directive; see 9.8.4 [namespace.udir].

According to 9.8.4 [namespace.udir] paragraph 1, that namespace is

the nearest enclosing namespace which contains both the using-directive and the nominated namespace.

That would seem to imply the following:

    namespace outer {
        namespace inner {
            int i;
        }
        void f() {
            using namespace inner;
        }
        int j = i;   // inner::i is "visible" in namespace outer
    }

Suggested resolution: Change the first sentence of 6.5.3 [basic.lookup.unqual] paragraph 2 to read:

The declarations from the namespace nominated by a using-directive become visible in the scope in which the using-directive appears after the using-directive.
History
Date User Action Args
2022-02-18 07:47:23adminsetmessages: + msg6656
2002-05-10 00:00:00adminsetmessages: + msg700
2002-05-10 00:00:00adminsetstatus: open -> nad
2000-05-31 00:00:00admincreate