]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Work around a bug in gcc 2.95 that prevented the compilation of tria_boundary.cc
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 26 Feb 2001 13:00:40 +0000 (13:00 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 26 Feb 2001 13:00:40 +0000 (13:00 +0000)
git-svn-id: https://svn.dealii.org/trunk@4029 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/grid/tria.h
deal.II/deal.II/source/grid/tria.cc

index 2828e3172d6be240b5a96baeecd75537db7f13cc..7d3b39841d6a75f57f372c657d29d2d7adcb9148 100644 (file)
@@ -1585,8 +1585,29 @@ class Triangulation : public TriaDimensionInfo<dim>,
                                      * declaration is used for the
                                      * default argument in
                                      * @p{set_boundary}.
-                                     */
-    static const StraightBoundary<dim> straight_boundary;
+                                     *
+                                     * The proper way would have been
+                                     * to use a static object here,
+                                     * rather than a pointer to an
+                                     * object. However, we have to
+                                     * work around a bug in gcc2.95,
+                                     * where the compiler tries to
+                                     * instantiate @p{Triangulation}
+                                     * while instantiating
+                                     * @p{Boundary} (which it needs
+                                     * to do, since local typedefs
+                                     * are involved), but then tries
+                                     * to in turn instantiate
+                                     * @p{StraightBoundary} because
+                                     * of this member variable. This
+                                     * is not needed since the member
+                                     * variable is a static one, but
+                                     * the compiler tries anyway and
+                                     * finds that it can't since the
+                                     * base class @p{Boundary} is not
+                                     * yet complete...
+                                     */
+    static const StraightBoundary<dim> *straight_boundary;
 
   public:
     
@@ -1733,7 +1754,7 @@ class Triangulation : public TriaDimensionInfo<dim>,
                                      * straight line.
                                      */
     void set_boundary (unsigned int         number,
-                      const Boundary<dim> &boundary_object = straight_boundary);
+                      const Boundary<dim> &boundary_object = *straight_boundary);
 
                                     /**
                                      * Return a constant reference to
index de52ea6c380667eb5575ad8b3482c80dd492bdd9..cfe83ed5b68fa9a018778a27efa2071a1d9cc5ca 100644 (file)
 #include <cmath>
 
 
+
+// initialize the @p{straight_boundary} pointer of the triangulation
+// class. for the reasons why it is done like this, see the
+// documentation of that member variable
+namespace 
+{
+  const StraightBoundary<deal_II_dimension> dummy_straight_boundary;
+};
+
+
 template <int dim>
-const StraightBoundary<dim> Triangulation<dim>::straight_boundary;
+const StraightBoundary<dim> *
+Triangulation<dim>::straight_boundary = &dummy_straight_boundary;
 
 
 
@@ -41,8 +52,8 @@ Triangulation<dim>::Triangulation (const MeshSmoothing smooth_grid) :
                                   // set default boundary for all possible components
   for (unsigned int i=0;i<255;++i)
     {
-      boundary[i] = &straight_boundary;
-      straight_boundary.subscribe();
+      boundary[i] = straight_boundary;
+      boundary[i]->subscribe();
     }
 };
 
@@ -86,8 +97,8 @@ void Triangulation<dim>::clear ()
   for (unsigned int i=0; i<255; ++i)
     {
       boundary[i]->unsubscribe ();
-      boundary[i] = &straight_boundary;
-      straight_boundary.subscribe ();
+      boundary[i] = straight_boundary;
+      boundary[i]->subscribe ();
     };
 
   number_cache = TriaNumberCache<dim>();

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.