[PATCH] D152788: [Clang] Show type in enum out of range diagnostic

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 14 09:30:26 PDT 2023


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!



================
Comment at: clang/test/SemaCXX/constant-expression-cxx11.cpp:2479-2486
+template<class T, unsigned size> struct Bitfield {
+  static constexpr T max = static_cast<T>((1 << size) - 1);
+};
+
+void testValueInRangeOfEnumerationValuesViaTemplate() {
+  Bitfield<E2, 3> good;
+  Bitfield<E2, 4> bad;
----------------
Equivalent but a bit easier to tell where the diagnostic is expected to happen at.

Perhaps a good follow-up would be to find out why we're not printing an "instantiated from here" note for this case (CC @shafik), but no need to do that for this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152788



More information about the cfe-commits mailing list