Commit e5a74850 authored by Dominik Charousset's avatar Dominik Charousset

Prevent zero-length arrays in types_array

parent 98d36c1c
...@@ -88,7 +88,7 @@ struct types_array_impl { ...@@ -88,7 +88,7 @@ struct types_array_impl {
static constexpr bool builtin_only = true; static constexpr bool builtin_only = true;
inline bool is_pure() const { return true; } inline bool is_pure() const { return true; }
// all types are builtin, perform lookup on constuction // all types are builtin, perform lookup on constuction
const uniform_type_info* data[sizeof...(T)]; const uniform_type_info* data[sizeof...(T) == 0 ? 1 : sizeof...(T)];
types_array_impl() : data{ta_util<caf_tinf, true, T>::get()...} {} types_array_impl() : data{ta_util<caf_tinf, true, T>::get()...} {}
inline const uniform_type_info* operator[](size_t p) const { inline const uniform_type_info* operator[](size_t p) const {
return data[p]; return data[p];
...@@ -103,7 +103,7 @@ struct types_array_impl<false, T...> { ...@@ -103,7 +103,7 @@ struct types_array_impl<false, T...> {
static constexpr bool builtin_only = false; static constexpr bool builtin_only = false;
inline bool is_pure() const { return false; } inline bool is_pure() const { return false; }
// contains std::type_info for all non-builtin types // contains std::type_info for all non-builtin types
const std::type_info* tinfo_data[sizeof...(T)]; const std::type_info* tinfo_data[sizeof...(T) == 0 ? 1 : sizeof...(T)];
// contains uniform_type_infos for builtin types and lazy initializes // contains uniform_type_infos for builtin types and lazy initializes
// non-builtin types at runtime // non-builtin types at runtime
mutable std::atomic<const uniform_type_info*> data[sizeof...(T)]; mutable std::atomic<const uniform_type_info*> data[sizeof...(T)];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment