Movatterモバイル変換


[0]ホーム

URL:


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

2025-12-20


2621. Kind of lookup forusing enum declarations

Section:9.8.2  [enum.udecl]    Status:C++23    Submitter:Sean Baxter    Date:2022-08-17

P2720R0 comment CA 054

[Accepted as a DR at the November, 2022 meeting.]

Consider:

enum class E {  a, b, c};using MyE = E;int main() {  using enum MyE;   // #1}

Does the lookup for theelaborated-enum-specifier at #1 usetype-only lookup per 6.5.6 [basic.lookup.elab]? There isimplementation divergence; EDG, gcc, and MSVC accept, clang rejects.

Suggested resolution [SUPERSEDED]:

Change in 9.8.2 [enum.udecl] paragraph 1 as follows:

Lookup for theelaborated-enum-specifier is as specifiedin 6.5.6 [basic.lookup.elab].Theelaborated-enum-specifier shall not name a dependent typeand the type shall have a reachableenum-specifier.

CWG telecon 2022-09-09:

The example at #1 is intended to be valid; even though the grammarsuggests that anelaborated-type-specifier is used here, anordinary (not a type-only) lookup is performed.

Proposed resolution (approved by CWG 2022-09-23) [SUPERSEDED]:

Change in 9.8.2 [enum.udecl] paragraph 1 as follows:

The terminal name of theelaborated-enum-specifierundergoes ordinary lookup (6.5.3 [basic.lookup.unqual],6.5.5 [basic.lookup.qual]).Theelaborated-enum-specifier shall not name a dependent typeand the type shall have a reachableenum-specifier.

CWG 2022-11-07:

Use the wording approach presented in CA-054, with necessaryadjunct fixes.

Proposed resolution (approved by CWG 2022-11-10):

Change the grammar before 9.2.9.5 [dcl.type.elab] paragraph 1 asfollows, merging the grammar productions:

elaborated-type-specifier :    class-key attribute-specifier-seqopt nested-name-specifieropt identifier    class-key simple-template-id    class-key nested-name-specifier templateopt simple-template-idelaborated-enum-specifier    elaborated-enum-specifier :    enumnested-name-specifieropt identifier

Change the grammar before 9.8.2 [enum.udecl] paragraph 1 as follows:

using-enum-declaration:    usingelaborated-enum-specifierenumusing-enum-declarator ;using-enum-declarator:    nested-name-specifieropt identifier    nested-name-specifieropt simple-template-id

Change in 9.8.2 [enum.udecl] paragraph 1 as follows:

Ausing-enum-declarator names the set of declarationsfound by lookup (6.5.3 [basic.lookup.unqual],6.5.5 [basic.lookup.qual]) fortheusing-enum-declarator.Theelaborated-enum-specifierusing-enum-declarator shallnot name a dependentdesignate a non-dependenttypeand the type shall havewith areachableenum-specifier.



[8]ページ先頭

©2009-2026 Movatter.jp