Created on 2021-02-12.00:00:00 last changed 47 months ago
According to 6.5.1 [basic.lookup.general] paragraphs 2-3,
...A declaration X precedes a program point P in a translation unit L if P follows X, X inhabits a class scope and is reachable from P, or else...
A single search in a scope S for a name N from a program point P finds all declarations that precede P to which any name that is the same as N (6.1 [basic.pre]) is bound in S.
These rules cause problems for finding enumerators when qualified by an exported name of its enumeration type, unlike a member of a class. For example:
export module A;
enum class X { x };
enum Y { y };
export module B;
import A;
export using XB = X;
export using YB = Y;
// client code
import B;
int main() {
XB x = XB::x; // should be OK because definition of X is reachable, even
// though A is not imported
YB y = YB::y; // similarly OK
YB z = ::y; // error, because y from module A is not visible
}
It would seem that this problem could be addressed by changing “inhabits a class scope” to “does not inhabit a namespace scope.”
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2021-11-15 00:00:00 | admin | set | status: open -> drafting |
| 2021-02-12 00:00:00 | admin | create | |