From e1ccfca620b08ef48e175490500b4e7571fa9b09 Mon Sep 17 00:00:00 2001
From: Wolfgang Bangerth <bangerth@colostate.edu>
Date: Thu, 18 Jan 2018 11:18:45 -0700
Subject: [PATCH] Add static_asserts for complex-valued cases.

---
 .../deal.II/lac/vector_operations_internal.h  | 22 +++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/include/deal.II/lac/vector_operations_internal.h b/include/deal.II/lac/vector_operations_internal.h
index 517ef3f76e..a485ab6d28 100644
--- a/include/deal.II/lac/vector_operations_internal.h
+++ b/include/deal.II/lac/vector_operations_internal.h
@@ -719,6 +719,17 @@ namespace internal
         VectorizedArray<Number> x, y;
         x.load(X+i);
         y.load(Y+i);
+
+        // the following operation in VectorizedArray does an element-wise
+        // scalar product without taking into account complex values and
+        // the need to take the complex-conjugate of one argument. this
+        // may be a bug, but because all VectorizedArray classes only
+        // work on real scalars, it doesn't really matter very much.
+        // in any case, assert that we really don't get here for
+        // complex-valued objects
+        static_assert (numbers::NumberTraits<Number>::is_complex == false,
+                       "This operation is not correctly implemented for "
+                       "complex-valued objects.");
         return x * y;
       }
 
@@ -867,6 +878,17 @@ namespace internal
         // may only load from W after storing in X because the pointers might
         // point to the same memory
         w.load(W+i);
+
+        // the following operation in VectorizedArray does an element-wise
+        // scalar product without taking into account complex values and
+        // the need to take the complex-conjugate of one argument. this
+        // may be a bug, but because all VectorizedArray classes only
+        // work on real scalars, it doesn't really matter very much.
+        // in any case, assert that we really don't get here for
+        // complex-valued objects
+        static_assert (numbers::NumberTraits<Number>::is_complex == false,
+                       "This operation is not correctly implemented for "
+                       "complex-valued objects.");
         return x * w;
       }
 
-- 
2.39.5