Title
Injection of names from elaborated-type-specifiers in friend declarations
Status
nad
Section
_N4868_.9.8.2.3 [namespace.memdef]
Submitter
Mike Miller

Created on 2008-02-06.00:00:00 last changed 179 months ago

Messages

Date: 2009-07-15.00:00:00

Rationale (July, 2009):

The current specification does not restrict injection of names in elaborated-type-specifiers, and the consensus of the CWG was that no change is needed on this point.

Date: 2022-11-20.07:54:16

_N4868_.9.8.2.3 [namespace.memdef] paragraph 3 is intended to prevent injection of names from friend declarations into the containing namespace scope:

If a friend declaration in a non-local class first declares a class or function the friend class or function is a member of the innermost enclosing namespace. The name of the friend is not found by unqualified lookup (6.5.3 [basic.lookup.unqual]) or by qualified lookup (6.5.5 [basic.lookup.qual]) until a matching declaration is provided in that namespace scope (either before or after the class definition granting friendship).

However, this does not address names declared by elaborated-type-specifiers that are part of the friend declaration. Are these names intended to be visibly injected? For example, is the following well-formed?

    class A {
        friend class B* f();
    };
    B* bp;    // Is B visible here?

Implementations differ in their treatment of this example: EDG and MSVC++ 8.0 accept it, while g++ 4.1.1 rejects it.

History
Date User Action Args
2009-08-03 00:00:00adminsetmessages: + msg2275
2009-08-03 00:00:00adminsetstatus: open -> nad
2008-02-06 00:00:00admincreate