]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Take over r27495 from branch_cmake:
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 11 Nov 2012 11:30:10 +0000 (11:30 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 11 Nov 2012 11:30:10 +0000 (11:30 +0000)
Silence -Warray-bounds warnings for clang

git-svn-id: https://svn.dealii.org/trunk@27500 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/base/point.h

index a87204fe21dbd212d64f59f2b02d9d4cfea399c4..b94c66b704cc959246ab2a4bd69edb3acc3a449c 100644 (file)
@@ -224,8 +224,12 @@ template <int dim, typename Number>
 inline
 Point<dim,Number>::Point (const Number x)
 {
-  Assert (dim==1, StandardExceptions::ExcInvalidConstructorCall());
-  this->values[0] = x;
+  switch(dim) {
+    case 1:
+      this->values[0] = x;
+    default:
+      Assert (dim==1, StandardExceptions::ExcInvalidConstructorCall());
+  }
 }
 
 
@@ -234,9 +238,13 @@ template <int dim, typename Number>
 inline
 Point<dim,Number>::Point (const Number x, const Number y)
 {
-  Assert (dim==2, StandardExceptions::ExcInvalidConstructorCall());
-  this->values[0] = x;
-  this->values[1] = y;
+  switch(dim) {
+    case 2:
+      this->values[0] = x;
+      this->values[1] = y;
+    default:
+      Assert (dim==2, StandardExceptions::ExcInvalidConstructorCall());
+  }
 }
 
 
@@ -245,10 +253,14 @@ template <int dim, typename Number>
 inline
 Point<dim,Number>::Point (const Number x, const Number y, const Number z)
 {
-  Assert (dim==3, StandardExceptions::ExcInvalidConstructorCall());
-  this->values[0] = x;
-  this->values[1] = y;
-  this->values[2] = z;
+  switch(dim) {
+    case 3:
+      this->values[0] = x;
+      this->values[1] = y;
+      this->values[2] = z;
+    default:
+      Assert (dim==3, StandardExceptions::ExcInvalidConstructorCall());
+  }
 }
 
 

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.