Browse Source

Fix error in TArrayRef constructor for a container: Elements with a different size should not be accepted even if they are convertible to TArrayRef value type.

akhropov 1 year ago
parent
commit
f9c0a70369
1 changed files with 3 additions and 0 deletions
  1. 3 0
      util/generic/array_ref.h

+ 3 - 0
util/generic/array_ref.h

@@ -64,6 +64,9 @@ public:
         : T_(container.data())
         , S_(container.size())
     {
+        static_assert(
+            sizeof(decltype(*container.data())) == sizeof(T),
+            "Attempt to create TArrayRef from a container of elements with a different size");
     }
 
     template <size_t N>