From 760768824af9291854d1bf78c4e9e430832a0faf Mon Sep 17 00:00:00 2001 From: Karl Ljungkvist Date: Tue, 22 Nov 2016 16:06:14 +0100 Subject: [PATCH] Add more static asserts for sensible template parameters --- include/deal.II/fe/fe.h | 8 ++++++++ include/deal.II/grid/tria.h | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/include/deal.II/fe/fe.h b/include/deal.II/fe/fe.h index 77732571df..5f54f94613 100644 --- a/include/deal.II/fe/fe.h +++ b/include/deal.II/fe/fe.h @@ -2721,6 +2721,14 @@ protected: friend class FEFaceValues; friend class FESubfaceValues; friend class FESystem; + + // explicitly check for sensible template arguments +#ifdef DEAL_II_WITH_CXX11 + static_assert (dim<=spacedim, + "The dimension of a FiniteElement must be less than or " + "equal to the space dimension in which it lives."); +#endif + }; diff --git a/include/deal.II/grid/tria.h b/include/deal.II/grid/tria.h index 9ba7656484..096c6554d2 100644 --- a/include/deal.II/grid/tria.h +++ b/include/deal.II/grid/tria.h @@ -3454,6 +3454,14 @@ private: template friend class dealii::internal::Triangulation::TriaObjects; + + // explicitly check for sensible template arguments +#ifdef DEAL_II_WITH_CXX11 + static_assert (dim<=spacedim, + "The dimension of a Triangulation must be less than or " + "equal to the space dimension in which it lives."); +#endif + }; -- 2.39.5