Created on 1998-10-24.00:00:00 last changed 307 months ago
Rationale (04/99): In 9.8.4 [namespace.udir] paragraph 4:
If name lookup finds a declaration for a name in two different namespaces, and the declarations do not declare the same entity and do not declare functions, the use of the name is ill-formed.The term entity applied to typedefs refers to the underlying type or class (Clause 6 [basic] , paragraph 3); therefore both declarations of size_t declare the same entity and the above example is well-formed.
Issue 1
9.11 [dcl.link] paragraph 6 says the following:
extern "C" int f(void); namespace A { extern "C" int f(void); }; using namespace A; int i = f(); // Ok because only one function f() or // ill-formedFor name lookup, both declarations of f are visible and overloading cannot distinguish between them. Has the compiler to check that these functions are really the same function or is the program in error?
Rationale: These are the same function for all purposes.
Issue 2
A similar question may arise with typedefs:
// vendor A typedef unsigned int size_t; // vendor B namespace std { typedef unsigned int size_t; } using namespace std; size_t something(); // error?Is this valid because the typedef size_t refers to the same type in both namespaces?
Rationale (04/99): In 9.8.4 [namespace.udir] paragraph 4:
If name lookup finds a declaration for a name in two different namespaces, and the declarations do not declare the same entity and do not declare functions, the use of the name is ill-formed.The term entity applied to typedefs refers to the underlying type or class (6.1 [basic.pre] paragraph 3); therefore both declarations of size_t declare the same entity and the above example is well-formed.
History | |||
---|---|---|---|
Date | User | Action | Args |
1999-09-14 00:00:00 | admin | set | messages: + msg195 |
1999-09-14 00:00:00 | admin | set | status: drafting -> nad |
1998-10-24 00:00:00 | admin | create |