]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Be explicit about initialization of static const Tensor variables 7669/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 31 Jan 2019 22:47:38 +0000 (23:47 +0100)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 31 Jan 2019 22:47:38 +0000 (23:47 +0100)
include/deal.II/base/patterns.h
include/deal.II/base/tensor_function.templates.h

index 2789bf8434077a40fb542629909256b3db4910c6..d4ea6babc0b2258652920e4bdc1fa20a008bdde8 100644 (file)
@@ -1521,7 +1521,7 @@ namespace Patterns
             std::is_same<T, signed char>::value || std::is_same<T, char>::value)
           str << static_cast<int>(value);
         else if (std::is_same<T, bool>::value)
-          str << (value ? "true" : "false");
+          str << (static_cast<bool>(value) ? "true" : "false");
         else
           str << value;
         AssertThrow(p->match(str.str()), ExcNoMatch(str.str(), p.get()));
index cb53e448c14d7620ced16e09c27211660798bed5..d760d22070bf2fe47ffd432d6ca76178d8611c84 100644 (file)
@@ -123,7 +123,7 @@ template <int rank, int dim, typename Number>
 typename TensorFunction<rank, dim, Number>::gradient_type
 ConstantTensorFunction<rank, dim, Number>::gradient(const Point<dim> &) const
 {
-  static const Tensor<rank + 1, dim, Number> zero;
+  static const Tensor<rank + 1, dim, Number> zero{};
 
   return zero;
 }
@@ -140,7 +140,7 @@ ConstantTensorFunction<rank, dim, Number>::gradient_list(
   Assert(gradients.size() == points.size(),
          ExcDimensionMismatch(gradients.size(), points.size()));
 
-  static const Tensor<rank + 1, dim, Number> zero;
+  static const Tensor<rank + 1, dim, Number> zero{};
 
   for (unsigned int i = 0; i < gradients.size(); ++i)
     gradients[i] = zero;

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.