[PATCH] D108451: [Sema] Avoid crash in CheckEnumConstant with contains-error expressions

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 24 04:58:27 PDT 2021


aaron.ballman added inline comments.


================
Comment at: clang/test/Sema/enum.cpp:1
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
----------------
hokein wrote:
> I'd put the test case in `clang/test/SemaCXX/recovery-expr-type.cpp`
+1 -- Sema is for Cish things and SemaCXX is for C++ish things (in general).


================
Comment at: clang/test/Sema/enum.cpp:8-9
+// When initializers contain errors, enumerators are non-type-dependent zeros.
+static_assert(Circular_A != 0, ""); // expected-error {{static_assert failed}}
+static_assert(Circular_B != 0, ""); // expected-error {{static_assert failed}}
----------------
Should we be static asserting this? It seems like emergent behavior more than something we intentionally want anyone to rely on.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108451/new/

https://reviews.llvm.org/D108451



More information about the cfe-commits mailing list