[clang] [Clang][Sema] Skip checking anonymous enum in using enum declaration (PR #87144)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 1 07:39:44 PDT 2024
================
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -verify -std=c++20 -fsyntax-only %s
+// expected-no-diagnostics
+
+enum {A, S, D, F};
+int main() {
+ using asdf = decltype(A);
+ using enum asdf; // this line causes the crash
+ return 0;
+}
----------------
AaronBallman wrote:
I'd like to see an additional test case demonstrating that we correctly added the enumerators to the correct scope:
```
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);
```
and
```
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
```
https://github.com/llvm/llvm-project/pull/87144
More information about the cfe-commits
mailing list