From: Jean-Paul Pelteret Date: Thu, 29 Dec 2022 22:05:33 +0000 (+0100) Subject: Fix compiler error for older version of GCC X-Git-Tag: v9.5.0-rc1~692^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=46a3d978568e951f5b8996bc5fa8453342e3870f;p=dealii.git Fix compiler error for older version of GCC --- diff --git a/include/deal.II/base/symmetric_tensor.h b/include/deal.II/base/symmetric_tensor.h index a544deeb9b..7dbcadabea 100644 --- a/include/deal.II/base/symmetric_tensor.h +++ b/include/deal.II/base/symmetric_tensor.h @@ -1953,6 +1953,8 @@ namespace internal typename SymmetricTensorAccessors:: StorageType<2, dim, Number>::base_tensor_type &data) { + static_assert(dim <= 3, "The selected dimension is not yet supported."); + // 1d is very simple and done first if (dim == 1) return data[0]; @@ -1989,7 +1991,6 @@ namespace internal // We cannot return a static variable, as this class must support number // types that require no instances of the number type to be in scope during // a reinitialization procedure (e.g. ADOL-C adtl::adouble). - Assert(false, ExcInternalError()); return data[0]; } @@ -2001,6 +2002,8 @@ namespace internal const typename SymmetricTensorAccessors:: StorageType<2, dim, Number>::base_tensor_type &data) { + static_assert(dim <= 3, "The selected dimension is not yet supported."); + // 1d is very simple and done first if (dim == 1) return data[0]; @@ -2037,7 +2040,6 @@ namespace internal // We cannot return a static variable, as this class must support number // types that require no instances of the number type to be in scope during // a reinitialization procedure (e.g. ADOL-C adtl::adouble). - Assert(false, ExcInternalError()); return data[0]; } @@ -2049,6 +2051,8 @@ namespace internal typename SymmetricTensorAccessors:: StorageType<4, dim, Number>::base_tensor_type &data) { + static_assert(dim <= 3, "The selected dimension is not yet supported."); + switch (dim) { case 1: @@ -2087,7 +2091,6 @@ namespace internal // We cannot return a static variable, as this class must support number // types that require no instances of the number type to be in scope during // a reinitialization procedure (e.g. ADOL-C adtl::adouble). - Assert(false, ExcInternalError()); return data[0][0]; } @@ -2098,6 +2101,8 @@ namespace internal const typename SymmetricTensorAccessors:: StorageType<4, dim, Number>::base_tensor_type &data) { + static_assert(dim <= 3, "The selected dimension is not yet supported."); + switch (dim) { case 1: @@ -2136,7 +2141,6 @@ namespace internal // We cannot return a static variable, as this class must support number // types that require no instances of the number type to be in scope during // a reinitialization procedure (e.g. ADOL-C adtl::adouble). - Assert(false, ExcInternalError()); return data[0][0]; }