DISTRHO / DPF

DISTRHO Plugin Framework
ISC License
670 stars 97 forks source link

build error: DISTRHO::String is not literal #440

Open thirtythreeforty opened 1 year ago

thirtythreeforty commented 1 year ago

I get the following error when including the DPF header:

In file included from .../vendor/DPF/distrho/DistrhoPlugin.hpp:20,
                 from .../src/MyPlugin.cpp:1:
.../vendor/DPF/distrho/DistrhoDetails.hpp:750:34: error: the type ‘const DISTRHO::Parameter’ of ‘constexpr’ variable ‘DISTRHO::kParameterBypass’ is not literal
  750 | static constexpr const Parameter kParameterBypass = {
      |                                  ^~~~~~~~~~~~~~~~
.../vendor/DPF/distrho/DistrhoDetails.hpp:570:8: note: ‘DISTRHO::Parameter’ is not literal because:
  570 | struct Parameter {
      |        ^~~~~~~~~
.../vendor/DPF/distrho/DistrhoDetails.hpp:582:12: note:   non-static data member ‘DISTRHO::Parameter::name’ has non-literal type
  582 |     String name;
      |            ^~~~
In file included from .../vendor/DPF/distrho/DistrhoDetails.hpp:20:
.../vendor/DPF/distrho/extra/String.hpp:34:7: note: ‘DISTRHO::String’ is not literal because:
   34 | class String
      |       ^~~~~~
.../vendor/DPF/distrho/extra/String.hpp:34:7: note:   ‘DISTRHO::String’ does not have ‘constexpr’ destructor

which is quite a good error message from GCC.

$ /usr/bin/c++ --version
c++ (GCC) 13.2.1 20230801

I am building with these flags:

-DDONT_SET_USING_DGL_NAMESPACE -std=gnu++20 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fdiagnostics-color=always -fno-gnu-unique

Although the destructor's non-trivial path calling std::free() should never fire, its presence still causes it not to be considered literal.