Am 02.12.21 um 22:39 schrieb Will Godfrey:
Date: Thu, 02 Dec 2021 12:56:15 -0800 From: "yuri@FreeBSD" <notificati...@github.com> To: Yoshimi/yoshimi <yosh...@noreply.github.com> Subject: [Yoshimi/yoshimi] 2.1.2.1: error: constexpr variable 'LN_BASE' must be initialized by a constant expression (Issue #156)
It fails when built with clang-12:
Misc/NumericFuncs.h:96:32: error: constexpr variable 'LN_BASE' must be initialized by a constant
expression static constexpr float LN_BASE = log(fraction? 1.0/base : double(base)); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...which is strange, because, to my understanding, the whole point of constexpr variables is to be initialised by a const expression, not just a constant. A "const expression" is anything that can be evaluated completely at compile time. As in our case, the logarithm. For that very reason, both "base" and the "fraction" toggle are template parameters, and chosen for each instantiation anew. Just a guess: maybe Clang is overly picky here, since we still set the language level at C++11, which indeed had already the keyword constexpr, but didn't yet allow evaluation of const expressions explicitly. Simply because at that time, the specifications and implementations weren't mature enough to be standardised. However, at that time, compilers with more or less complete C++11 support *did* already evaluate constant expressions (since this was the whole point of the exercise). Btw, why are we still setting the language level to C++11? I vaguely recall a discussion to the end that we could without damage raise the level to C++14 (and still support Ubuntu 14.04)... -- Hermann _______________________________________________ Yoshimi-devel mailing list Yoshimi-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/yoshimi-devel