Created on 1998-10-24.00:00:00 last changed 262 months ago
6.4 [basic.scope] paragraph 4 says:
Given a set of declarations in a single declarative region, each of which specifies the same unqualified name,9.3.4.7 [dcl.fct.default] paragraph 9 says:
- they shall all refer to the same entity, or all refer to functions ...
When a declaration of a function is introduced by way of a using-declaration (9.9 [namespace.udecl]), any default argument information associated with the declaration 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 which multiple declarations were found, and if at least two of these declarations — or the declarations they refer to in the case of using-declarations — specify a 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 |