]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Tests: base/utilities_13.cc - workaround for clang 7313/head
authorMatthias Maier <tamiko@43-1.org>
Tue, 9 Oct 2018 16:00:57 +0000 (11:00 -0500)
committerMatthias Maier <tamiko@43-1.org>
Tue, 9 Oct 2018 16:00:57 +0000 (11:00 -0500)
Clang issues a spurious arithmetic exception if this code snippet is
called with a reference long double pointing into the vector. Work
around this issue by explicitly writing out the long double twice.

tests/base/utilities_13.cc

index 10fa8b65b909aa9297dbd970493b157d62f45c76..5f6f3ed93e4af1f26685621ae70e33ba554c18f5 100644 (file)
@@ -113,12 +113,17 @@ test3()
                             ((Integer)1 << min_bits) - 1);
 
   // make sure conversion is within bounds:
-  const std::vector<Number> points = {0.2, 0.7};
-  for (const auto &v : points)
-    {
-      const Integer i = (Integer)(v * (Number)max);
-      Assert(i > 0 && i < max, ExcInternalError());
-    }
+  {
+    const Number  v = 0.2;
+    const Integer i = (Integer)(v * (Number)max);
+    Assert(i > 0 && i < max, ExcInternalError());
+  }
+
+  {
+    const Number  v = 0.7;
+    const Integer i = (Integer)(v * (Number)max);
+    Assert(i > 0 && i < max, ExcInternalError());
+  }
 
   {
     const Number  v = 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.