[语法问题] 模板不匹配-clang++ -std=c++20 -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables

[语法问题] 模板不匹配-clang++ -std=c++20 -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables,第1张

背景:我在编译一个开源的链接器 mold, 想着用它加速一下本地的构建,但是构建的最后一步碰到了错误。
项目地址:

https://github.com/rui314/mold.git

编译步骤:

git clone https://github.com/rui314/mold.git
cd mold
git checkout v1.4.2
make -j`nproc` CXX=clang++ CXXFLAGS="-stdlib=libc++"
sudo make install

出错的文件:

clang++ -std=c++17 -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -DMOLD_VERSION=\"1.4.2\" -DLIBDIR="\"/usr/local
/lib\"" -Ithird-party/mimalloc/include -Ithird-party/tbb/include -MT out/macho/main.o -MMD -MP -MF out/macho/main.d -stdlib=libc++ -c -o out/macho/main.o macho/main.cc

报错信息:

macho/main.cc:453:11: error: no viable overloaded '+='
  counter += std::erase_if(osec.members, [](Subsection *subsec) {
  ~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
macho/main.cc:464:7: note: in instantiation of function template specialization 'mold::macho::uniquify_cstrings' requested here
      uniquify_cstrings(ctx, *(OutputSection *)chunk);
      ^
macho/main.cc:1052:3: note: in instantiation of function template specialization 'mold::macho::merge_cstring_sections' requested here
  merge_cstring_sections(ctx);
  ^
macho/main.cc:998:14: note: in instantiation of function template specialization 'mold::macho::do_main' requested here
      return do_main(argc, argv);
             ^
macho/main.cc:1121:10: note: in instantiation of function template specialization 'mold::macho::do_main' requested here
  return do_main(argc, argv);
         ^
macho/../mold.h:643:12: note: candidate function not viable: cannot convert argument of incomplete type 'void' to 'int' for 1st argument
  Counter &operator+=(int delta) {
           ^
macho/main.cc:453:11: error: no viable overloaded '+='
  counter += std::erase_if(osec.members, [](Subsection *subsec) {
  ~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
macho/main.cc:464:7: note: in instantiation of function template specialization 'mold::macho::uniquify_cstrings' requested here
      uniquify_cstrings(ctx, *(OutputSection *)chunk);
      ^
macho/main.cc:1052:3: note: in instantiation of function template specialization 'mold::macho::merge_cstring_sections' requested here
  merge_cstring_sections(ctx);
  ^
macho/main.cc:1121:10: note: in instantiation of function template specialization 'mold::macho::do_main' requested here
  return do_main(argc, argv);
         ^
macho/../mold.h:643:12: note: candidate function not viable: cannot convert argument of incomplete type 'void' to 'int' for 1st argument
  Counter &operator+=(int delta) {
           ^
2 errors generated.


先留个坑,后面解决.

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/2990839.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-09-23
下一篇 2022-09-23

发表评论

登录后才能评论

评论列表(0条)

保存