]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix C++20 Tensor initialization 17744/head
authorBruno Turcksin <bruno.turcksin@gmail.com>
Mon, 28 Oct 2024 15:16:32 +0000 (11:16 -0400)
committerBruno Turcksin <bruno.turcksin@gmail.com>
Mon, 28 Oct 2024 15:16:32 +0000 (11:16 -0400)
include/deal.II/base/tensor.h

index 40ba24ba1c48f1e1aedf62d29771f0f58d3383e5..b7f2c0e5306213f078b81ee7d2209a659a437d7a 100644 (file)
@@ -1292,7 +1292,11 @@ Tensor<rank_, dim, Number>::Tensor()
       // returning a zero instead.
       []<std::size_t... I>(
         const std::index_sequence<I...> &) 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<Number>::value(0.0);

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.