From f21aaf7250b82c53b4ccebe4fe55697647a12ce4 Mon Sep 17 00:00:00 2001 From: maier Date: Wed, 7 Aug 2013 09:03:04 +0000 Subject: [PATCH] When reading the C++ standard 12.4 I'm not quite sure whether this is a bug or not. But anyway, simplifying the destructor call resolves this issue, so there is no need for a guard and an expensive configure test. git-svn-id: https://svn.dealii.org/branches/branch_port_to_libcxx@30241 0785d39b-7218-0410-832d-ea1e28bc413d --- .../cmake/checks/check_03_compiler_bugs.cmake | 37 ------------------- deal.II/include/deal.II/base/config.h.in | 6 --- deal.II/source/fe/fe_values.cc | 32 +++------------- 3 files changed, 6 insertions(+), 69 deletions(-) diff --git a/deal.II/cmake/checks/check_03_compiler_bugs.cmake b/deal.II/cmake/checks/check_03_compiler_bugs.cmake index cf49fb0e57..bb63ba0740 100644 --- a/deal.II/cmake/checks/check_03_compiler_bugs.cmake +++ b/deal.II/cmake/checks/check_03_compiler_bugs.cmake @@ -21,43 +21,6 @@ ######################################################################## -# -# Some compiler versions, notably ICC, have trouble with the -# following code in which we explicitly call a destructor. -# This has to be worked around with a typedef. The problem is -# that the workaround fails with some other compilers, so that -# we can not unconditionally use the workaround... -# -# - Wolfgang Bangerth, Matthias Maier, rewritten 2012 -# -CHECK_CXX_COMPILER_BUG( - " - namespace dealii - { - namespace FEValuesViews - { - template struct Scalar {}; - } - - template - struct X - { - FEValuesViews::Scalar scalars[dim*spacedim]; - - void f() - { - scalars[0].dealii::FEValuesViews::Scalar::~Scalar (); - } - }; - - template struct X<2,2>; - } - int main() { return 0; } - " - DEAL_II_EXPLICIT_DESTRUCTOR_BUG - ) - - # # On some gcc 4.3 snapshots, a 'const' qualifier on a return type triggers a # warning. This is unfortunate, since we happen to stumble on this diff --git a/deal.II/include/deal.II/base/config.h.in b/deal.II/include/deal.II/base/config.h.in index c0791a0430..ca90c59df9 100644 --- a/deal.II/include/deal.II/base/config.h.in +++ b/deal.II/include/deal.II/base/config.h.in @@ -188,12 +188,6 @@ * Configured in check_2_compiler_bugs: * ****************************************/ -/* Defined if we have to work around a bug where the compiler doesn't accept - * an explicit destructor call. See the aclocal.m4 file in the top-level - * directory for a description of this bug. - */ -#cmakedefine DEAL_II_EXPLICIT_DESTRUCTOR_BUG - /* Defined if we have to work around a bug with some compilers that will not * allow us to specify a fully specialized class of a template as a friend. * See the aclocal.m4 file in the top-level directory for a description of diff --git a/deal.II/source/fe/fe_values.cc b/deal.II/source/fe/fe_values.cc index 0602d5fd09..9b63f27839 100644 --- a/deal.II/source/fe/fe_values.cc +++ b/deal.II/source/fe/fe_values.cc @@ -1641,12 +1641,7 @@ namespace internal scalars.resize (n_scalars); for (unsigned int component=0; component::~Scalar (); -#else - typedef dealii::FEValuesViews::Scalar ScalarView; - scalars[component].ScalarView::~ScalarView (); -#endif + scalars[component].~Scalar(); new (&scalars[component]) dealii::FEValuesViews::Scalar(fe_values, component); @@ -1665,12 +1660,7 @@ namespace internal vectors.resize (n_vectors); for (unsigned int component=0; component::~Vector (); -#else - typedef dealii::FEValuesViews::Vector VectorView; - vectors[component].VectorView::~VectorView (); -#endif + vectors[component].~Vector (); new (&vectors[component]) dealii::FEValuesViews::Vector(fe_values, component); @@ -1685,13 +1675,8 @@ namespace internal symmetric_second_order_tensors.resize(n_symmetric_second_order_tensors); for (unsigned int component = 0; component < n_symmetric_second_order_tensors; ++component) { -#ifndef DEAL_II_EXPLICIT_DESTRUCTOR_BUG - symmetric_second_order_tensors[component] - .dealii::FEValuesViews::SymmetricTensor<2, dim, spacedim>::~SymmetricTensor(); -#else - typedef dealii::FEValuesViews::SymmetricTensor<2, dim, spacedim> SymmetricTensorView; - symmetric_second_order_tensors[component].SymmetricTensorView::~SymmetricTensorView(); -#endif + symmetric_second_order_tensors[component].~SymmetricTensor(); + new (&symmetric_second_order_tensors[component]) dealii::FEValuesViews::SymmetricTensor<2, dim, spacedim > (fe_values, component); @@ -1707,13 +1692,8 @@ namespace internal second_order_tensors.resize(n_second_order_tensors); for (unsigned int component = 0; component < n_second_order_tensors; ++component) { -#ifndef DEAL_II_EXPLICIT_DESTRUCTOR_BUG - second_order_tensors[component] - .dealii::FEValuesViews::Tensor<2, dim, spacedim>::~Tensor(); -#else - typedef dealii::FEValuesViews::Tensor<2, dim, spacedim> TensorView; - second_order_tensors[component].TensorView::~TensorView(); -#endif + second_order_tensors[component].~Tensor(); + new (&second_order_tensors[component]) dealii::FEValuesViews::Tensor<2, dim, spacedim > (fe_values, component); -- 2.39.5