Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
thirtythreeforty opened this issue Nov 13, 2023 · 0 comments
Open

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

thirtythreeforty opened this issue Nov 13, 2023 · 0 comments

Comments

@thirtythreeforty
Copy link

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.

thirtythreeforty added a commit to thirtythreeforty/DPF that referenced this issue Nov 19, 2023
This triggers bugs in String and other classes regarding
constexpr-compatibility of constructors and destructors.  It does not
appear to be tested correctly in CI.

Works around DISTRHO#440.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant