From: Wolfgang Bangerth Date: Tue, 1 Dec 2020 02:47:01 +0000 (-0700) Subject: Mark some variables as constexpr. X-Git-Tag: v9.3.0-rc1~829^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11286%2Fhead;p=dealii.git Mark some variables as constexpr. These are global variables, and as such should not actually have been declared in a header file without marking them as 'extern' and providing a definition in a .cc file. If the compiler had not inlined the definitions of these variables, we would have gotten duplicate symbol linker errors. C++11 provides us with a way around this: mark these variables as 'constexpr', thereby avoiding the bug we currently have. --- diff --git a/include/deal.II/base/std_cxx17/cmath.h b/include/deal.II/base/std_cxx17/cmath.h index bf0f8e93ba..756ba5ed6e 100644 --- a/include/deal.II/base/std_cxx17/cmath.h +++ b/include/deal.II/base/std_cxx17/cmath.h @@ -28,11 +28,11 @@ DEAL_II_NAMESPACE_OPEN namespace std_cxx17 { #ifndef DEAL_II_HAVE_CXX17_BESSEL_FUNCTIONS - double (&cyl_bessel_j)(double, - double) = boost::math::cyl_bessel_j; - float (&cyl_bessel_jf)(float, - float) = boost::math::cyl_bessel_j; - long double (&cyl_bessel_jl)(long double, long double) = + constexpr double (&cyl_bessel_j)(double, double) = + boost::math::cyl_bessel_j; + constexpr float (&cyl_bessel_jf)(float, float) = + boost::math::cyl_bessel_j; + constexpr long double (&cyl_bessel_jl)(long double, long double) = boost::math::cyl_bessel_j; #else using std::cyl_bessel_j;