From 95ea5951b18e058236c6589b893298b0655eb072 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 19 Oct 2020 08:29:00 -0700 Subject: [PATCH] Try again to work around a GCC 5 issue --- alc/bsinc_tables.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/alc/bsinc_tables.cpp b/alc/bsinc_tables.cpp index 6052e1b1..893e9792 100644 --- a/alc/bsinc_tables.cpp +++ b/alc/bsinc_tables.cpp @@ -141,15 +141,22 @@ constexpr BSincHeader bsinc12_hdr{60, 11}; constexpr BSincHeader bsinc24_hdr{60, 23}; -/* FIXME: This should be constexpr, but the temporary filter arrays are too - * big. This requires using heap space, which is not allowed in a constexpr - * function (maybe in C++20). +/* NOTE: GCC 5 has an issue with BSincHeader objects being in an anonymous + * namespace while also being used as non-type template parameters. */ +#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ < 6 +template +struct BSincFilterArray { + alignas(16) std::array mTable; + + BSincFilterArray(const BSincHeader &hdr) +#else template struct BSincFilterArray { alignas(16) std::array mTable; BSincFilterArray() +#endif { using filter_type = double[][BSincPhaseCount+1][BSincPointsMax]; auto filter = std::make_unique(BSincScaleCount); @@ -254,12 +261,13 @@ struct BSincFilterArray { } }; -/* FIXME: These can't be constexpr due to the calls reaching the compiler's - * step limit. - */ +#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ < 6 +const BSincFilterArray bsinc12_filter{bsinc12_hdr}; +const BSincFilterArray bsinc24_filter{bsinc24_hdr}; +#else const BSincFilterArray bsinc12_filter{}; const BSincFilterArray bsinc24_filter{}; - +#endif constexpr BSincTable GenerateBSincTable(const BSincHeader &hdr, const float *tab) { -- 2.11.4.GIT