diff options
author | Shafik Yaghmour <shafik.yaghmour@intel.com> | 2022-07-28 15:26:15 -0700 |
---|---|---|
committer | Shafik Yaghmour <shafik.yaghmour@intel.com> | 2022-07-28 15:27:50 -0700 |
commit | b3645353041818f61e2580635409ddb81ff5a272 (patch) | |
tree | 84e6c16d57e685b4721c16f4261d4c5e73263fd3 /cross-project-tests | |
parent | 58526b2d2be932e893218857cc47a16fb05cf1c0 (diff) | |
download | llvm-b3645353041818f61e2580635409ddb81ff5a272.zip llvm-b3645353041818f61e2580635409ddb81ff5a272.tar.gz llvm-b3645353041818f61e2580635409ddb81ff5a272.tar.bz2 |
[Clang] Diagnose ill-formed constant expression when setting a non fixed enum to a value outside the range of the enumeration values
DR2338 clarified that it was undefined behavior to set the value outside the
range of the enumerations values for an enum without a fixed underlying type.
We should diagnose this with a constant expression context.
Differential Revision: https://reviews.llvm.org/D130058
Diffstat (limited to 'cross-project-tests')
-rw-r--r-- | cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.cpp b/cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.cpp index 3990c28..6b2807c 100644 --- a/cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.cpp +++ b/cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.cpp @@ -25,9 +25,9 @@ struct udt { }; } template<template<typename> class T> void ttp_user() { } -enum Enumeration { Enumerator1, Enumerator2, Enumerator3 = 1 }; +enum Enumeration : int { Enumerator1, Enumerator2, Enumerator3 = 1 }; enum class EnumerationClass { Enumerator1, Enumerator2, Enumerator3 = 1 }; -enum { AnonEnum1, AnonEnum2, AnonEnum3 = 1 }; +enum : int { AnonEnum1, AnonEnum2, AnonEnum3 = 1 }; enum EnumerationSmall : unsigned char { kNeg = 0xff }; } template <typename... Ts> |