diff options
Diffstat (limited to 'clang/test/AST/ByteCode')
-rw-r--r-- | clang/test/AST/ByteCode/cxx11.cpp | 8 | ||||
-rw-r--r-- | clang/test/AST/ByteCode/libcxx/deref-to-array.cpp | 2 | ||||
-rw-r--r-- | clang/test/AST/ByteCode/typeid.cpp | 13 |
3 files changed, 22 insertions, 1 deletions
diff --git a/clang/test/AST/ByteCode/cxx11.cpp b/clang/test/AST/ByteCode/cxx11.cpp index 72bc762..8efd320 100644 --- a/clang/test/AST/ByteCode/cxx11.cpp +++ b/clang/test/AST/ByteCode/cxx11.cpp @@ -146,6 +146,14 @@ void testValueInRangeOfEnumerationValues() { const NumberType neg_one = (NumberType) ((NumberType) 0 - (NumberType) 1); // ok, not a constant expression context } +struct EnumTest { + enum type { + Type1, + BOUND + }; + static const type binding_completed = type(BOUND + 1); // both-error {{in-class initializer for static data member is not a constant expression}} \ + // both-note {{integer value 2 is outside the valid range of values}} +}; template<class T, unsigned size> struct Bitfield { static constexpr T max = static_cast<T>((1 << size) - 1); diff --git a/clang/test/AST/ByteCode/libcxx/deref-to-array.cpp b/clang/test/AST/ByteCode/libcxx/deref-to-array.cpp index 2a527ab..7cfcd76 100644 --- a/clang/test/AST/ByteCode/libcxx/deref-to-array.cpp +++ b/clang/test/AST/ByteCode/libcxx/deref-to-array.cpp @@ -270,7 +270,7 @@ template <class _Op, class _Yp> void __is_derived_from_view_interface(); template <class _Tp> bool enable_view = derived_from<_Tp, int> || - requires { ranges::__is_derived_from_view_interface; }; + requires { ranges::__is_derived_from_view_interface<_Tp, int>(); }; template <class> concept range = requires { ranges::end; }; template <class _Tp> diff --git a/clang/test/AST/ByteCode/typeid.cpp b/clang/test/AST/ByteCode/typeid.cpp index 00b01c8..aca18d4 100644 --- a/clang/test/AST/ByteCode/typeid.cpp +++ b/clang/test/AST/ByteCode/typeid.cpp @@ -59,3 +59,16 @@ namespace TypeidPtrInEvaluationResult { consteval const std::type_info *ftype_info() { return &typeid(c); } const std::type_info *T1 = ftype_info(); } + +// Regression test for crash in ArrayElemPtrPop with typeid pointers. GH-163127 +namespace TypeidPtrRegression { + void dontcrash() { + constexpr auto res = ((void**)&typeid(int))[0]; // both-error {{must be initialized by a constant expression}} \ + // both-note {{cast that performs the conversions of a reinterpret_cast is not allowed in a constant expression}} + } + void dontcrash2() { + constexpr auto res = ((void**)&typeid(int))[1]; // both-error {{must be initialized by a constant expression}} \ + // both-note {{cast that performs the conversions of a reinterpret_cast is not allowed in a constant expression}} + } +} + |