Skip to content

clang allows for multiple declarations introduced by using enum #121334

@Rush10233

Description

@Rush10233

The following code is accepted by clang under -std=c++20:

struct S2 {
  enum B {
    A
  };
  using enum B ;
};

MSVC and GCC choose to reject it as there would be a name conflict:

<source>:5:16: error: 'using S2::B::A' conflicts with a previous declaration
    5 |   using enum B ;
      |                ^
<source>:3:5: note: previous declaration 'S2::B S2::A'
    3 |     A
      |     ^

While the using enum B statement here actually seems to be meaningless, I'm not quite sure whether this should be rejected or not.

https://godbolt.org/z/3e3aGxnWW

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"diverges-from:gccDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions