mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 14:06:39 +00:00

Try to fix https://github.com/llvm/llvm-project/issues/86790 `getFETokenInfo` requires `DeclarationName` shouldn't be empty and this will produce crash when checking name conflict of an anonymous `NamedDecl` in `Sema::PushOnScopeChains` and whether it's a reserved identifier or not. These wouldn't happen when it's a anonymous enum and we can skip the checking and just add the declaration to current scope. Co-authored-by: huqizhi <836744285@qq.com>
33 lines
649 B
C++
33 lines
649 B
C++
// RUN: %clang_cc1 -verify -std=c++20 -fsyntax-only %s
|
|
|
|
enum {A, S, D, F};
|
|
int main() {
|
|
using asdf = decltype(A);
|
|
using enum asdf; // this line causes the crash
|
|
return 0;
|
|
}
|
|
|
|
namespace N1 {
|
|
enum {A, S, D, F};
|
|
constexpr struct T {
|
|
using asdf = decltype(A);
|
|
using enum asdf;
|
|
} t;
|
|
|
|
static_assert(t.D == D);
|
|
static_assert(T::S == S);
|
|
}
|
|
|
|
namespace N2 {
|
|
enum {A, S, D, F};
|
|
constexpr struct T {
|
|
struct {
|
|
using asdf = decltype(A);
|
|
using enum asdf;
|
|
} inner;
|
|
} t;
|
|
|
|
static_assert(t.inner.D == D);
|
|
static_assert(t.D == D); // expected-error {{no member named 'D' in 'N2::T'}}
|
|
}
|