Created on1998-10-24.00:00:00 last changed277 months ago
6.4 [basic.scope] paragraph 4says:
Given a set of declarations in a single declarative region, each ofwhich specifies the same unqualified name,9.3.4.7 [dcl.fct.default] paragraph 9says:
- they shall all refer to the same entity, or all refer to functions ...
When a declaration of a function is introduced by way of ausing-declaration (9.10 [namespace.udecl]),any default argument information associated with thedeclaration is imported as well.This is not really clear regarding what happens in the following case:
namespace A { extern "C" void f(int = 5); } namespace B { extern "C" void f(int = 7); } using A::f; using B::f; f(); // ???Proposed resolution (10/00):Add the following at the end of 12.2.4 [over.match.best]:
If the best viable function resolves to a function for whichmultiple declarations were found, and if at least two of thesedeclarations — orthe declarations they refer to in the case ofusing-declarations — specifya default argument that made the function viable, the program is ill-formed.[Example:
namespace A {
extern "C" void f(int = 5);
}
namespace B {
extern "C" void f(int = 5);
}using A::f;
using B::f;void use() {
f(3); // OK, default argument was not used for viability
f(); // Error: found default argument twice
}—end example]
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2003-04-25 00:00:00 | admin | set | status: dr -> tc1 |
| 2000-11-18 00:00:00 | admin | set | status: ready -> dr |
| 2000-05-21 00:00:00 | admin | set | status: drafting -> ready |
| 1998-10-24 00:00:00 | admin | create | |