From b3645353041818f61e2580635409ddb81ff5a272 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Thu, 28 Jul 2022 15:26:15 -0700 Subject: [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 --- .../clang_llvm_roundtrip/simplified_template_names.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cross-project-tests') 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 3990c2809e2e..6b2807ccaf13 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 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 -- cgit v1.2.1