Skip to content

fixes to support gcc 16 - #1189

Merged
mmatyas merged 1 commit into
mmatyas:masterfrom
itzTheMeow:cpp20
Oct 2, 2026
Merged

mmatyas merged 1 commit into
mmatyas:masterfrom
itzTheMeow:cpp20

Conversation

@itzTheMeow

Copy link
Copy Markdown
Contributor

nixpkgs upgraded their gcc toolchain to GCC 16 which sets the default C++ dialect to C++20 which causes some build failures that i encountered while packaging
source: https://gcc.gnu.org/gcc-16/changes.html#cxx

we can get around this with the build flag -DCMAKE_CXX_STANDARD=17, however given that the 2017 C++ standard is almost 10 years old it's possible that it gets deprecated in the future

this pr fixes those explicit failures. theres still some deprecation warnings when building this with the newer toolchain, however the application still builds and functions

i tested both builds under gcc15 and gcc16 and they appear to work normally and all tests pass

@mmatyas

mmatyas commented Oct 2, 2026

Copy link
Copy Markdown
Owner

An established, registered industry standard doesn't just "get deprecated", and even C++98 is perfectly supported, but I agree it's beneficial to keep things up to date. Could you also post the errors you encounter? The reinterpret part is understandable, but from the top of my head, I don't remember what new rule causes Entry and Error to need an explicit constructor.

@itzTheMeow

Copy link
Copy Markdown
Contributor Author

The initializer lists gave me this error:

/build/source/src/backend/parsers/MetaFile.cpp:140:16: error: no match for call to '(const std::function<void(const metafile::Error&)>) (<brace-enclosed initializer list>)'
  140 |         onError({ linenum, LOGMSG("line invalid, skipped") });
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • there is 1 candidate
    /nix/store/5q6bdxkp7lc70gn9mnf4yiybrx8ry5xq-gcc-16.2.0/include/c++/16.2.0/bits/std_function.h:324:11:
      324 |     class function<_Res(_ArgTypes...)>
          |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • candidate 1: '_Res std::function<_Res(_ArgTypes ...)>::operator()(_ArgTypes ...) const [with _Res = void; _ArgTypes = {const metafile::Error&}]'
      /nix/store/5q6bdxkp7lc70gn9mnf4yiybrx8ry5xq-gcc-16.2.0/include/c++/16.2.0/bits/std_function.h:577:7:
        577 |       operator()(_ArgTypes... __args) const
            |       ^~~~~~~~
      • no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const metafile::Error&'
        /nix/store/5q6bdxkp7lc70gn9mnf4yiybrx8ry5xq-gcc-16.2.0/include/c++/16.2.0/bits/std_function.h:577:27:
          577 |       operator()(_ArgTypes... __args) const
              |                  ~~~~~~~~~^~~~~~~~~~
make[2]: *** [src/backend/CMakeFiles/pegasus-backend.dir/build.make:226: src/backend/CMakeFiles/pegasus-backend.dir/parsers/MetaFile.cpp.o] Error 1

@mmatyas

mmatyas commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Wouldn't specifying the type fix this? onError(Error { linenum, LOGMSG("line invalid, skipped") });

@itzTheMeow

Copy link
Copy Markdown
Contributor Author

made this change and got the full error

/home/xela/Documents/pegasus-frontend/src/backend/parsers/MetaFile.cpp: In function ‘void metafile::read_stream(QTextStream&, const std::function<void(const Entry&)>&, const std::function<void(const Error&)>&)’:
/home/xela/Documents/pegasus-frontend/src/backend/parsers/MetaFile.cpp:73:23: error: no matching function for call to ‘metafile::Error::Error(<brace-enclosed initializer list>)’
   73 |     Error error {0, {}};
      |                       ^
  • there is 1 candidate
In file included from /home/xela/Documents/pegasus-frontend/src/backend/parsers/MetaFile.h:20,
                 from /home/xela/Documents/pegasus-frontend/src/backend/parsers/MetaFile.cpp:18:
    • candidate 1: ‘metafile::Error::Error(metafile::Error&&)’
      /home/xela/Documents/pegasus-frontend/src/backend/parsers/MetaFile.h:44:15:
         44 |     MOVE_ONLY(Error)
            |               ^~~~~
    • in definition of macro ‘MOVE_ONLY’
         23 |     T(T&&) = default; \
            |     ^
      • candidate expects 1 argument, 2 provided
      • in definition of macro ‘MOVE_ONLY’
           23 |     T(T&&) = default; \
              |     ^
/home/xela/Documents/pegasus-frontend/src/backend/parsers/MetaFile.cpp:74:27: error: no matching function for call to ‘metafile::Entry::Entry(<brace-enclosed initializer list>)’
   74 |     Entry entry {0, {}, {}};
      |                           ^
  • there is 1 candidate
    • candidate 1: ‘metafile::Entry::Entry(metafile::Entry&&)’
      /home/xela/Documents/pegasus-frontend/src/backend/parsers/MetaFile.h:38:15:
         38 |     MOVE_ONLY(Entry)
            |               ^~~~~
    • in definition of macro ‘MOVE_ONLY’
         23 |     T(T&&) = default; \
            |     ^
      • candidate expects 1 argument, 3 provided
      • in definition of macro ‘MOVE_ONLY’
           23 |     T(T&&) = default; \
              |     ^
/home/xela/Documents/pegasus-frontend/src/backend/parsers/MetaFile.cpp: In lambda function:
/home/xela/Documents/pegasus-frontend/src/backend/parsers/MetaFile.cpp:79:94: error: no matching function for call to ‘metafile::Error::Error(<brace-enclosed initializer list>)’
   79 |                 onError(Error { entry.line, LOGMSG("attribute value missing, entry ignored") });
      |                                                                                              ^
  • there is 1 candidate
    • candidate 1: ‘metafile::Error::Error(metafile::Error&&)’
      /home/xela/Documents/pegasus-frontend/src/backend/parsers/MetaFile.h:44:15:
         44 |     MOVE_ONLY(Error)
            |               ^~~~~
    • in definition of macro ‘MOVE_ONLY’
         23 |     T(T&&) = default; \
            |     ^
      • candidate expects 1 argument, 2 provided
      • in definition of macro ‘MOVE_ONLY’
           23 |     T(T&&) = default; \
              |     ^
/home/xela/Documents/pegasus-frontend/src/backend/parsers/MetaFile.cpp: In function ‘void metafile::read_stream(QTextStream&, const std::function<void(const Entry&)>&, const std::function<void(const Error&)>&)’:
/home/xela/Documents/pegasus-frontend/src/backend/parsers/MetaFile.cpp:105:119: error: no matching function for call to ‘metafile::Error::Error(<brace-enclosed initializer list>)’
  105 |                 onError(Error { linenum, LOGMSG("line starts with whitespace, but no attribute has been defined yet") });
      |                                                                                                                       ^
  • there is 1 candidate
    • candidate 1: ‘metafile::Error::Error(metafile::Error&&)’
      /home/xela/Documents/pegasus-frontend/src/backend/parsers/MetaFile.h:44:15:
         44 |     MOVE_ONLY(Error)
            |               ^~~~~
    • in definition of macro ‘MOVE_ONLY’
         23 |     T(T&&) = default; \
            |     ^
      • candidate expects 1 argument, 2 provided
      • in definition of macro ‘MOVE_ONLY’
           23 |     T(T&&) = default; \
              |     ^
/home/xela/Documents/pegasus-frontend/src/backend/parsers/MetaFile.cpp:140:66: error: no matching function for call to ‘metafile::Error::Error(<brace-enclosed initializer list>)’
  140 |         onError(Error { linenum, LOGMSG("line invalid, skipped") });
      |                                                                  ^
  • there is 1 candidate
    • candidate 1: ‘metafile::Error::Error(metafile::Error&&)’
      /home/xela/Documents/pegasus-frontend/src/backend/parsers/MetaFile.h:44:15:
         44 |     MOVE_ONLY(Error)
            |               ^~~~~
    • in definition of macro ‘MOVE_ONLY’
         23 |     T(T&&) = default; \
            |     ^
      • candidate expects 1 argument, 2 provided
      • in definition of macro ‘MOVE_ONLY’
           23 |     T(T&&) = default; \
              |     ^

aforementioned macro:
image

@mmatyas

mmatyas commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Eh whatever, let's just roll with it. Thanks again!

@mmatyas
mmatyas merged commit 5d58223 into mmatyas:master Oct 2, 2026
6 of 7 checks passed
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

Successfully merging this pull request may close these issues.

2 participants