Fails to compile with g++ 15

Open
#7,683 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cmake, cpp

Research direction

Reproduce the failure with the repository's CMake build using g++ 15, then inspect src/passes/Strip.cpp around the constructors reported in the diagnostic. Compare the warning and compiler-option behavior with the project's build configuration; done means the project compiles successfully with g++ 15 without treating these diagnostics as errors.

Written by the indexing model from the issue text.

Description

The repository currently fails to compile with g++ 15 (e.g. on Fedora):

[ 60%] Building CXX object CMakeFiles/binaryen.dir/src/passes/ReReloop.cpp.o
In file included from /usr/include/c++/15/functional:61,
                 from /home/moritz/Documents/binaryen/src/passes/Strip.cpp:22:
In copy constructor ‘std::function<_Res(_ArgTypes ...)>::function(const std::function<_Res(_ArgTypes ...)>&) [with _Res = bool; _ArgTypes = {wasm::CustomSection&}]’,
    inlined from ‘wasm::Strip::Strip(Decider)’ at /home/moritz/Documents/binaryen/src/passes/Strip.cpp:37:28,
    inlined from ‘wasm::Pass* wasm::createStripDebugPass()’ at /home/moritz/Documents/binaryen/src/passes/Strip.cpp:62:4:
/usr/include/c++/15/bits/std_function.h:393:17: error: ‘<anonymous>’ may be used uninitialized [-Werror=maybe-uninitialized]
  393 |             __x._M_manager(_M_functor, __x._M_functor, __clone_functor);
      |             ~~~~^~~~~~~~~~
/usr/include/c++/15/bits/std_function.h: In function ‘wasm::Pass* wasm::createStripDebugPass()’:
/usr/include/c++/15/bits/std_function.h:269:7: note: by argument 2 of type ‘const std::_Any_data&’ to ‘static bool std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_manager(std::_Any_data&, const std::_Any_data&, std::_Manager_operation) [with _Res = bool; _Functor = wasm::createStripDebugPass()::<lambda(const wasm::CustomSection&)>; _ArgTypes = {wasm::CustomSection&}]’ declared here
  269 |       _M_manager(_Any_data& __dest, const _Any_data& __source,
      |       ^~~~~~~~~~
/home/moritz/Documents/binaryen/src/passes/Strip.cpp:58:20: note: ‘<anonymous>’ declared here
   58 |   return new Strip([&](const CustomSection& curr) {
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   59 |     return curr.name == BinaryConsts::CustomSections::Name ||
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   60 |            curr.name == BinaryConsts::CustomSections::SourceMapUrl ||
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   61 |            curr.name.find(".debug") == 0 || curr.name.find("reloc..debug") == 0;
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   62 |   });
      |   ~                 
In copy constructor ‘std::function<_Res(_ArgTypes ...)>::function(const std::function<_Res(_ArgTypes ...)>&) [with _Res = bool; _ArgTypes = {wasm::CustomSection&}]’,
    inlined from ‘wasm::Strip::Strip(Decider)’ at /home/moritz/Documents/binaryen/src/passes/Strip.cpp:37:28,
    inlined from ‘wasm::Pass* wasm::createStripDWARFPass()’ at /home/moritz/Documents/binaryen/src/passes/Strip.cpp:68:4:
/usr/include/c++/15/bits/std_function.h:393:17: error: ‘<anonymous>’ may be used uninitialized [-Werror=maybe-uninitialized]
  393 |             __x._M_manager(_M_functor, __x._M_functor, __clone_functor);
      |             ~~~~^~~~~~~~~~
/usr/include/c++/15/bits/std_function.h: In function ‘wasm::Pass* wasm::createStripDWARFPass()’:
/usr/include/c++/15/bits/std_function.h:269:7: note: by argument 2 of type ‘const std::_Any_data&’ to ‘static bool std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_manager(std::_Any_data&, const std::_Any_data&, std::_Manager_operation) [with _Res = bool; _Functor = wasm::createStripDWARFPass()::<lambda(const wasm::CustomSection&)>; _ArgTypes = {wasm::CustomSection&}]’ declared here
  269 |       _M_manager(_Any_data& __dest, const _Any_data& __source,
      |       ^~~~~~~~~~
/home/moritz/Documents/binaryen/src/passes/Strip.cpp:66:20: note: ‘<anonymous>’ declared here
   66 |   return new Strip([&](const CustomSection& curr) {
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   67 |     return curr.name.find(".debug") == 0 || curr.name.find("reloc..debug") == 0;
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   68 |   });
      |   ~                 
In copy constructor ‘std::function<_Res(_ArgTypes ...)>::function(const std::function<_Res(_ArgTypes ...)>&) [with _Res = bool; _ArgTypes = {wasm::CustomSection&}]’,
    inlined from ‘wasm::Strip::Strip(Decider)’ at /home/moritz/Documents/binaryen/src/passes/Strip.cpp:37:28,
    inlined from ‘wasm::Pass* wasm::createStripProducersPass()’ at /home/moritz/Documents/binaryen/src/passes/Strip.cpp:74:4:
/usr/include/c++/15/bits/std_function.h:393:17: error: ‘<anonymous>’ may be used uninitialized [-Werror=maybe-uninitialized]
  393 |             __x._M_manager(_M_functor, __x._M_functor, __clone_functor);
      |             ~~~~^~~~~~~~~~
/usr/include/c++/15/bits/std_function.h: In function ‘wasm::Pass* wasm::createStripProducersPass()’:
/usr/include/c++/15/bits/std_function.h:269:7: note: by argument 2 of type ‘const std::_Any_data&’ to ‘static bool std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_manager(std::_Any_data&, const std::_Any_data&, std::_Manager_operation) [with _Res = bool; _Functor = wasm::createStripProducersPass()::<lambda(const wasm::CustomSection&)>; _ArgTypes = {wasm::CustomSection&}]’ declared here
  269 |       _M_manager(_Any_data& __dest, const _Any_data& __source,
      |       ^~~~~~~~~~
/home/moritz/Documents/binaryen/src/passes/Strip.cpp:72:20: note: ‘<anonymous>’ declared here
   72 |   return new Strip([&](const CustomSection& curr) {
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   73 |     return curr.name == BinaryConsts::CustomSections::Producers;
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   74 |   });
      |   ~                 
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics
cc1plus: note: unrecognized command-line option ‘-Wno-implicit-int-float-conversion’ may have been intended to silence earlier diagnostics
cc1plus: all warnings being treated as errors
make[2]: *** [CMakeFiles/binaryen.dir/build.make:1731: CMakeFiles/binaryen.dir/src/passes/Strip.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:488: CMakeFiles/binaryen.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Dominant language
WebAssembly
Stars
8.6k
Forks
885
Avg merge
1d 20h
Merged PRs (30d)
64

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from WebAssembly/binaryen

All issues in WebAssembly/binaryen

Similar issues

More Build System issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.