Created on 2024-04-07.00:00:00 last changed 4 months ago
Proposed resolution (approved by CWG 2024-06-26):
Change in 9.7.2 [enum.udecl] paragraph 1 as follows:
A using-enum-declarator names the set of declarations found by type-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<class T> using EE = T; void g() { using enum EE<E>; // OK }-- end example ]
Additional notes (May, 2024)
An example is desirable. Also, the treatment of the following example is unclear:
template<class T> using AA = T; enum AA<E> e; // ill-formed elaborated-type-specifier using enum AA<E>; // Clang and MSVC reject, GCC and EDG accept
Proposed resolution (reviewed by CWG 2024-05-17) [SUPERSEDED]:
Change in 9.7.2 [enum.udecl] paragraph 1 as follows:
A using-enum-declarator names the set of declarations found by type-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.
[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 but typedef 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.
History | |||
---|---|---|---|
Date | User | Action | Args |
2024-07-20 13:52:34 | admin | set | status: ready -> dr |
2024-06-26 19:39:40 | admin | set | status: tentatively ready -> ready |
2024-05-31 21:07:31 | admin | set | messages: + msg7715 |
2024-05-31 21:07:31 | admin | set | status: review -> tentatively ready |
2024-05-20 09:48:12 | admin | set | messages: + msg7705 |
2024-05-20 09:48:12 | admin | set | status: tentatively ready -> review |
2024-05-17 22:24:28 | admin | set | messages: + msg7702 |
2024-05-17 22:24:28 | admin | set | status: open -> tentatively ready |
2024-04-07 00:00:00 | admin | create |