Skip to content

Commit

Permalink
In complex_get, Fix for compilers that need a return in the impossibl…
Browse files Browse the repository at this point in the history
…e situation

where I >= 2
  • Loading branch information
nliber committed May 28, 2024
1 parent 5b8928b commit a377c3b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/src/Kokkos_Complex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ template <size_t I, typename ComplexForwardingRef>
KOKKOS_FUNCTION constexpr auto&& complex_get(
ComplexForwardingRef&& z) noexcept {
static_assert(I < 2);
if constexpr (I == 0) return static_cast<ComplexForwardingRef&&>(z).re_;
if constexpr (I == 1) return static_cast<ComplexForwardingRef&&>(z).im_;
if constexpr (I == 0)
return static_cast<ComplexForwardingRef&&>(z).re_;
else
return static_cast<ComplexForwardingRef&&>(z).im_;
}
} // namespace Impl

Expand Down

0 comments on commit a377c3b

Please sign in to comment.