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

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 19 22:31:58 PDT 2022


shafik added inline comments.


================
Comment at: clang/test/Sema/aarch64-sve-intrinsics/acle_sve_imm.cpp:209
   svprfb(pg, const_void_ptr, svprfop(14));
-  // expected-error-re at +1 {{argument value {{[0-9]+}} is outside the valid range [0, 13]}}
+  // expected-error-re at +1 {{must be a constant integer}}
   svprfb_vnum(pg, const_void_ptr, 0, svprfop(-1));
----------------
This test was invoking undefined behavior. So I modified the diagnostic it was looking for. I believe this is still faithful to the original test.


================
Comment at: clang/test/SemaTemplate/temp_arg_enum_printing.cpp:20
   NamedEnumNS::foo<(NamedEnum)1>();
   // CHECK: template<> void foo<(NamedEnumNS::NamedEnum)2>()
   NamedEnumNS::foo<(NamedEnum)2>();
----------------
This line invoked undefined behavior if the underlying type is not fixed, so I modified the enum to be scoped. This meant the checks had to be updated but the test still test what it meant to.


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

https://reviews.llvm.org/D130058



More information about the cfe-commits mailing list