]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add a cast to make a conversion valid in code that's dead.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 13 Dec 2008 17:35:18 +0000 (17:35 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 13 Dec 2008 17:35:18 +0000 (17:35 +0000)
git-svn-id: https://svn.dealii.org/trunk@17930 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/grid/tria_accessor.templates.h

index 19f95e2e4b32614427570bd2fe8818b13f2f219b..a12f67684c3e4f4985cc6732de19c4900960b79d 100644 (file)
@@ -1392,8 +1392,19 @@ TriaAccessor<structdim, dim, spacedim>::refinement_case() const
            return (static_cast<RefinementCase<structdim> >
                    (this->objects().children[this->present_index] != -1
                     ?
-                    RefinementCase<1>::cut_x :
-                    RefinementCase<1>::no_refinement));
+                                                     // cast the branches
+                                                     // here first to uchar
+                                                     // and then (above) to
+                                                     // RefinementCase<structdim>
+                                                     // so that the
+                                                     // conversion is valid
+                                                     // even for the case
+                                                     // structdim>1 (for
+                                                     // which this part of
+                                                     // the code is dead
+                                                     // anyway)
+                    static_cast<unsigned char>(RefinementCase<1>::cut_x) :
+                    static_cast<unsigned char>(RefinementCase<1>::no_refinement)));
 
       default:
            Assert (static_cast<unsigned int> (this->present_index) <

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.