From: Roland Schulz Date: Sun, 26 Apr 2020 19:10:51 +0000 (-0700) Subject: Add clang WA X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=30e28dc352a33a294969bf187a743bb0441397dc;p=alexxy%2Fgromacs.git Add clang WA --- diff --git a/src/gromacs/listed_forces/bonded.cpp b/src/gromacs/listed_forces/bonded.cpp index 4f90a31585..129ab880d3 100644 --- a/src/gromacs/listed_forces/bonded.cpp +++ b/src/gromacs/listed_forces/bonded.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -3968,11 +3968,18 @@ struct BondedInteractions int nrnbIndex; }; +// Bug in old clang versions prevents constexpr. constexpr is needed for MSVC. +#if defined(__clang__) && __clang_major__ < 6 +# define CONSTEXPR_EXCL_OLD_CLANG const +#else +# define CONSTEXPR_EXCL_OLD_CLANG constexpr +#endif + /*! \brief Lookup table of bonded interaction functions * * This must have as many entries as interaction_function in ifunc.cpp */ template -constexpr std::array c_bondedInteractionFunctions = { +CONSTEXPR_EXCL_OLD_CLANG std::array c_bondedInteractionFunctions = { BondedInteractions{ bonds, eNR_BONDS }, // F_BONDS BondedInteractions{ g96bonds, eNR_BONDS }, // F_G96BONDS BondedInteractions{ morse_bonds, eNR_MORSE }, // F_MORSE @@ -4068,7 +4075,8 @@ constexpr std::array c_bondedInteractionFunctions = { }; /*! \brief List of instantiated BondedInteractions list */ -constexpr gmx::EnumerationArray> c_bondedInteractionFunctionsPerFlavor = { +CONSTEXPR_EXCL_OLD_CLANG +gmx::EnumerationArray> c_bondedInteractionFunctionsPerFlavor = { c_bondedInteractionFunctions, c_bondedInteractionFunctions, c_bondedInteractionFunctions,