icpc 19 fails to compile AMReX
Issue #2758
new
AMReX contains code like this:
#include <string_view>
static constexpr std::string_view parser_f2_s[] =
{
"pow",
"atan2",
"gt",
"lt",
"geq",
"leq",
"eq",
"neq",
"and",
"or",
"heaviside",
"jn",
"min",
"max",
"fmod"
};
which fails to compile with “icpc (ICC) 19.1.3.304 20200925” with
$ icpc -gxx-name=g++ -std=gnu++17 -c dummy.cc
dummy.cc(4): error: expression must have a constant value
{
^
dummy.cc(3): note: attempt to access run-time storage
static constexpr std::string_view parser_f2_s[] =
^
compilation aborted for dummy.cc (code 2)
a workaround is to manually count the vector elements:
static constexpr std::string_view parser_f2_s[15] =
which compiles fine. g++ is gcc-9.3.0, which itself would compile the file fine (so it is a compiler issue, not a STL issue). Can be tested on db1.