Created on 2004-07-23.00:00:00 last changed 208 months ago
[Voted into WP at October 2005 meeting.]
Proposed resolution (October 2004):
Add the following text as a new paragraph at the end of 9.9.2 [namespace.def]:
The enclosing namespaces of a declaration are those namespaces in which the declaration lexically appears, except for a redeclaration of a namespace member outside its original namespace (e.g., a definition as specified in _N4868_.9.8.2.3 [namespace.memdef]). Such a redeclaration has the same enclosing namespaces as the original declaration. [Example:namespace Q { namespace V { void f(); // enclosing namespaces are the global namespace, Q, and Q::V class C { void m(); }; } void V::f() { // enclosing namespaces are the global namespace, Q, and Q::V extern void h(); // ... so this declares Q::V::h } void V::C::m() { // enclosing namespaces are the global namespace, Q, and Q::V } }—end example]
Consider the following bit of code:
namespace N {
struct S {
void f();
};
}
using namespace N;
void S::f() {
extern void g(); // ::g or N::g?
}
In 6.7 [basic.link] paragraph 7 the Standard says (among other things),
When a block scope declaration of an entity with linkage is not found to refer to some other declaration, then that entity is a member of the innermost enclosing namespace.
The question then is whether N is an “enclosing namespace” for the local declaration of g()?
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2008-10-05 00:00:00 | admin | set | status: wp -> cd1 |
| 2006-04-22 00:00:00 | admin | set | status: dr -> wp |
| 2005-10-22 00:00:00 | admin | set | messages: + msg1271 |
| 2005-10-22 00:00:00 | admin | set | status: ready -> dr |
| 2005-05-01 00:00:00 | admin | set | status: review -> ready |
| 2004-11-07 00:00:00 | admin | set | messages: + msg1050 |
| 2004-11-07 00:00:00 | admin | set | status: open -> review |
| 2004-07-23 00:00:00 | admin | create | |