[ET Trac] #2758: icpc 19 fails to compile AMReX

Roland Haas trac-noreply at einsteintoolkit.org
Thu Sep 21 09:28:00 CDT 2023


#2758: icpc 19 fails to compile AMReX

 Reporter: Roland Haas
   Status: new
Milestone: 
  Version: 
     Type: bug
 Priority: major
Component: EinsteinToolkit thorn

AMReX contains code like this:  

```c++
#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.

--
Ticket URL: https://bitbucket.org/einsteintoolkit/tickets/issues/2758/icpc-19-fails-to-compile-amrex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.einsteintoolkit.org/pipermail/trac/attachments/20230921/3dd8f7e6/attachment.htm>


More information about the Trac mailing list