Fix GCC false positive -Warray-bounds in geom::swizzle when using ubsan
This commit is contained in:
parent
ad752f0ea1
commit
fad1580379
1 changed files with 5 additions and 0 deletions
|
|
@ -21,12 +21,17 @@ namespace psemek::geom
|
|||
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
|
||||
template <std::size_t ... I>
|
||||
constexpr auto swizzle = [](auto const & x){
|
||||
static_assert(((I == -1 || I < std::decay_t<decltype(x)>::static_dimension) && ...));
|
||||
using result = typename detail::swizzle_rebind<std::decay_t<decltype(x)>>::template type<sizeof...(I)>;
|
||||
using element = std::decay_t<decltype(x[0])>;
|
||||
return result{(I == (-1) ? element{} : x[I])...};
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue