CWG Issue 2877 (original) (raw)
This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 117a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-04-13
2877. Type-only lookup for using-enum-declarator
Section: 9.8.2 [enum.udecl]Status: DRWPSubmitter: Richard SmithDate: 2024-04-07
[Accepted as a DR at the June, 2024 meeting.]
Issue 2621 claimed to ask the question whether lookup for using enum declarations was supposed to be type-only, but the example actually highlighted the difference between_elaborated-type-specifier_ lookup (where finding nothing buttypedef names is ill-formed) and ordinary lookup.
However, consider:
enum A { x, y }; void f() { int A; using enum A; // #1, error: names non-type int A using T = enum A; // #2, OK, names ::A }
The two situations should both be type-only lookups for consistency, although #2 would not find typedefs.
Proposed resolution (reviewed by CWG 2024-05-17) [SUPERSEDED]:
Change in 9.8.2 [enum.udecl] paragraph 1 as follows:
A using-enum-declarator names the set of declarations found bytype-only lookup (6.5.1 [basic.lookup.general]
6.5.3 [basic.lookup.unqual], 6.5.5 [basic.lookup.qual]) for the using-enum-declarator (6.5.3 [basic.lookup.unqual], 6.5.5 [basic.lookup.qual]). The _using-enum-declarator_shall designate a non-dependent type with a reachable enum-specifier.
Additional notes (May, 2024)
An example is desirable. Also, the treatment of the following example is unclear:
template using AA = T; enum AA e; // ill-formed elaborated-type-specifier using enum AA; // Clang and MSVC reject, GCC and EDG accept
Proposed resolution (approved by CWG 2024-06-26):
Change in 9.8.2 [enum.udecl] paragraph 1 as follows:
A using-enum-declarator names the set of declarations found bytype-only lookup (6.5.1 [basic.lookup.general]
6.5.3 [basic.lookup.unqual], 6.5.5 [basic.lookup.qual]) for the using-enum-declarator (6.5.3 [basic.lookup.unqual], 6.5.5 [basic.lookup.qual]). The _using-enum-declarator_shall designate a non-dependent type with a reachable enum-specifier. [ Example:enum E { x }; void f() { int E; using enum E; // OK } using F = E; using enum F; // OK template using EE = T; void g() { using enum EE; // OK }
-- end example ]