From be4880971d4e2a41cebe50f23f7d6dbdf065f779 Mon Sep 17 00:00:00 2001 From: wolf Date: Fri, 22 Mar 2002 18:24:10 +0000 Subject: [PATCH] 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 --- deal.II/base/include/base/quadrature.h | 81 ++++++++++++++++++++++++-- deal.II/base/source/quadrature.cc | 3 +- 2 files changed, 79 insertions(+), 5 deletions(-) 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), -- 2.39.5