From: Bruno Turcksin Date: Mon, 28 Oct 2024 15:16:32 +0000 (-0400) Subject: Fix C++20 Tensor initialization X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F17744%2Fhead;p=dealii.git Fix C++20 Tensor initialization --- diff --git a/include/deal.II/base/tensor.h b/include/deal.II/base/tensor.h index 40ba24ba1c..b7f2c0e530 100644 --- a/include/deal.II/base/tensor.h +++ b/include/deal.II/base/tensor.h @@ -1292,7 +1292,11 @@ Tensor::Tensor() // returning a zero instead. []( const std::index_sequence &) constexpr -> decltype(values) { - if constexpr (rank_ == 1) + if constexpr (dim == 0) + { + return {}; + } + else if constexpr (rank_ == 1) { auto get_zero_and_ignore_argument = [](int) { return internal::NumberType::value(0.0);