A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.github.io/CWG/issues/2480.html below:

CWG Issue 2480

This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 117b. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-08-11

2480. Lookup for enumerators in modulesSection: 6.5.1  [basic.lookup.general]     Status: drafting     Submitter: Richard Smith     Date: 2021-02-12

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.”


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4