From 70a5cd53f645ff70f6dbcb306fbde3bc778abece Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 21 Nov 2022 08:52:33 -0700 Subject: [PATCH] [algs] Assert trivial copy assignable in stable_sort --- src/hb-algs.hh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/hb-algs.hh b/src/hb-algs.hh index 1e2e8e2b5..e5e549f35 100644 --- a/src/hb-algs.hh +++ b/src/hb-algs.hh @@ -1156,6 +1156,9 @@ hb_qsort (void *base, size_t nel, size_t width, template static inline void hb_stable_sort (T *array, unsigned int len, int(*compar)(const T2 *, const T2 *), T3 *array2 = nullptr) { + static_assert (hb_is_trivially_copy_assignable (T), ""); + static_assert (hb_is_trivially_copy_assignable (T3), ""); + for (unsigned int i = 1; i < len; i++) { unsigned int j = i;