Skip to content

using enum error & crash #59014

Closed as not planned
Closed as not planned
@urnathan

Description

@urnathan

A weird error and a crash

struct X 
{
  enum Masks {Mask = 1,Shift = 0};
};

void Foo (int a)
{
  using enum X::Masks;

  auto u = (Mask); // weird error
  auto v = (Mask << Shift); // ICE
}
~/llvm/trunk/build/bin/clang++ -std=c++20 -c uenum.cc 
uenum.cc:10:8: error: variable 'u' with type 'auto' has incompatible initializer of type '<overloaded function type>'
  auto u = (Mask);
       ^   ~~~~~~
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /home/nathan/llvm/trunk/build/bin/clang++ -std=c++20 -c uenum.cc
1.	uenum.cc:11:26: current parser token ')'
2.	uenum.cc:7:1: parsing function body 'Foo'
3.	uenum.cc:7:1: in compound statement ('{}')

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partycrashPrefer [crash-on-valid] or [crash-on-invalid]duplicateResolved as duplicate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions