From: Wolfgang Bangerth Date: Fri, 22 Mar 2002 18:24:10 +0000 (+0000) Subject: Work around a really ugly bug in Suns Forte compiler, which manifests itself at the... X-Git-Tag: v8.0.0~18243 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90ce62279047756ec70e083df63b196011314a11;p=dealii.git Work around a really ugly bug in Suns Forte compiler, which manifests itself at the following testcase: /* ---------------------------------------------------------- */ /* Internal compiler error in abi2_mangler::entity_expression */ /* when compiled with -g. */ template < int dim > struct T { typedef T SubT; T (SubT); }; template T::T (SubT) {}; template class T<3> ; If compiled with -g, the compiler gets an internal compiler error... git-svn-id: https://svn.dealii.org/trunk@5604 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/include/base/quadrature.h b/deal.II/base/include/base/quadrature.h index efff37f7f5..408591f9e9 100644 --- a/deal.II/base/include/base/quadrature.h +++ b/deal.II/base/include/base/quadrature.h @@ -79,8 +79,43 @@ class Quadrature : public Subscriptor * object of one dimension * less. For cells, this would * then be a face quadrature. + * + * Since Sun's Forte compiler has + * trouble (well, an internal + * compiler error) if we typedef + * @p{typedef Quadrature + * SubQuadrature}, we put this + * type into a structure. Since + * again, if the structure is not + * templatized itself, the + * compiler barfs, we put a + * template to it. Now it + * works. Fortunately you will + * not usually come into contact + * with this kludge, but rather + * use the typedef'd type + * directly. We beg your pardon + * for doing such nasty things. + * + * For better readability we + * later typedef this so-created + * type to one in the enclosing + * class. + */ + template + struct SubQuadratureHelper + { + typedef Quadrature type; + }; + + /** + * Typedef the kludge declared + * above to a type in the class + * in which we would like to use + * it. */ - typedef Quadrature SubQuadrature; + typedef typename SubQuadratureHelper::type SubQuadrature; + /** * Number of quadrature points. @@ -98,9 +133,13 @@ class Quadrature : public Subscriptor * formula in a dimension one * less than the present and a * formula in one dimension. + * + * @p{SubQuadrature::type} + * expands to + * @p{Quadrature}. */ Quadrature (const SubQuadrature &, - const Quadrature<1> &); + const Quadrature<1> &); /** * Construct a quadrature formula @@ -295,8 +334,42 @@ class QProjector * object of one dimension * less. For cells, this would * then be a face quadrature. + * + * Since Sun's Forte compiler has + * trouble (well, an internal + * compiler error) if we typedef + * @p{typedef Quadrature + * SubQuadrature}, we put this + * type into a structure. Since + * again, if the structure is not + * templatized itself, the + * compiler barfs, we put a + * template to it. Now it + * works. Fortunately you will + * not usually come into contact + * with this kludge, but rather + * use the typedef'd type + * directly. We beg your pardon + * for doing such nasty things. + * + * For better readability we + * later typedef this so-created + * type to one in the enclosing + * class. + */ + template + struct SubQuadratureHelper + { + typedef Quadrature type; + }; + + /** + * Typedef the kludge declared + * above to a type in the class + * in which we would like to use + * it. */ - typedef Quadrature SubQuadrature; + typedef typename SubQuadratureHelper::type SubQuadrature; /** * Compute the quadrature points @@ -306,7 +379,7 @@ class QProjector * details, see the general doc * for this class. */ - static void project_to_face (const SubQuadrature &quadrature, + static void project_to_face (const SubQuadrature &quadrature, const unsigned int face_no, typename std::vector > &q_points); diff --git a/deal.II/base/source/quadrature.cc b/deal.II/base/source/quadrature.cc index c43175d15c..71da6368c9 100644 --- a/deal.II/base/source/quadrature.cc +++ b/deal.II/base/source/quadrature.cc @@ -97,7 +97,8 @@ Quadrature<1>::Quadrature (const Quadrature<0> &, template Quadrature::Quadrature (const SubQuadrature &q1, - const Quadrature<1> &q2) : + const Quadrature<1> &q2) + : n_quadrature_points (q1.n_quadrature_points * q2.n_quadrature_points), quadrature_points (n_quadrature_points),