]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Work around a compiler bug in gcc2.95. (Takeover of fix from main branch.)
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 26 Feb 2001 13:03:44 +0000 (13:03 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 26 Feb 2001 13:03:44 +0000 (13:03 +0000)
git-svn-id: https://svn.dealii.org/branches/Branch-3-1@4031 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 8efd3bd745a0036a67e837b1b67754e6faced750..1769b4a9b0443fc902f1d887abb85d57b9d37f1e 100644 (file)
@@ -1589,8 +1589,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:
     
@@ -1737,7 +1758,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 0e0f0220910fc06fef70c5cd092494a9fec40f6c..4f294c2244ec8a35b1ab6e78d937adff3878f0d9 100644 (file)
 /*----------------------------   boundary-function.h     ---------------------------*/
 
 #include <base/subscriptor.h>
-#include <grid/tria.h>
+#include <base/point.h>
+
+
+template <int dim> class Triangulation;
+
 
 
 /**
index 9401a3884fd04f1d9b24d7f94e860a47612839e7..d6e4040b6aa5f189825c2304e20e4eb5afc1038f 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.