[PATCH] D130058: [Clang] Diagnose ill-formed constant expression when setting a non fixed enum to a value outside the range of the enumeration values

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 28 11:35:27 PDT 2022


erichkeane added inline comments.


================
Comment at: clang/test/SemaCXX/enum-scoped.cpp:330
 namespace PR35586 {
-  enum C { R, G, B };
+  enum C { R=-1, G, B };
   enum B { F = (enum C) -1, T}; // this should compile cleanly, it used to assert.
----------------
shafik wrote:
> @erichkeane not sure if this fix for the test maintains the original intent of the test or not.
>From the looks of it, the problem (https://github.com/llvm/llvm-project/commit/bf5fad86db497775a4f0279b8a806d150c0fa201) was that the RHS of this expression (`F = (enum C) -1`) was not an ICE, it was an eum.  So I don't think this changes the AST at all, which should have hit the same crash.


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

https://reviews.llvm.org/D130058



More information about the cfe-commits mailing list