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

error: 'result_of<(lambda at /tmp/sourcepawn/vm/watchdog_timer.cpp:60:50) &()>' is deprecated: use 'std::invoke_result' instead #131

Open
peace-maker opened this issue Jan 9, 2025 · 1 comment
Labels

Comments

@peace-maker
Copy link
Member

Trying to compile sourcepawn on Ubuntu 24.04 with clang 18 fails.

[2982] clang++ -m64 -pipe -Wall -Werror -Wno-switch -fvisibility=hidden -O3 -fPIC -Wno-invalid-offsetof -g3 -std=c++17 -fvisibility-inlines-hidden -Wno-delete-non-virtual-dtor -Wno-unused-private-field -fno-rtti -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-implicit-exception-spec-mismatch -DNDEBUG -DKE_THREADSAFE -D_GNU_SOURCE -I /tmp/sourcepawn -I /tmp/sourcepawn/include -I /tmp/sourcepawn/third_party -I /tmp/sourcepawn/third_party/amtl -I /tmp/sourcepawn/objdir/includes -I /tmp/sourcepawn/third_party/amtl -I /tmp/sourcepawn/include -I /tmp/sourcepawn/vm -MD -MF watchdog_timer.d -c /tmp/sourcepawn/vm/watchdog_timer.cpp -o watchdog_timer.o
In file included from /tmp/sourcepawn/vm/watchdog_timer.cpp:21:
In file included from /tmp/sourcepawn/third_party/amtl/amtl/am-thread.h:32:
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/functional:552:2: error: 'result_of<(lambda at /tmp/sourcepawn/vm/watchdog_timer.cpp:60:50) &()>' is deprecated: use 'std::invoke_result' instead [-Werror,-Wdeprecated-declarations]
  552 |         using _Res_type_impl
      |         ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/functional:556:2: note: in instantiation of template type alias '_Res_type_impl' requested here
  556 |         using _Res_type = _Res_type_impl<_Functor, _CallArgs, _Bound_args...>;
      |         ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/functional:586:28: note: in instantiation of template type alias '_Res_type' requested here
  586 |                typename _Result = _Res_type<tuple<_Args...>>>
      |                                   ^
/tmp/sourcepawn/third_party/amtl/amtl/am-thread.h:104:21: note: in instantiation of template class 'std::_Bind<(lambda at /tmp/sourcepawn/vm/watchdog_timer.cpp:60:50) ()>' requested here
  104 |     auto callback = std::bind(std::forward<Function>(f), std::forward<Args>(args)...);
      |                     ^
/tmp/sourcepawn/vm/watchdog_timer.cpp:60:17: note: in instantiation of function template specialization 'ke::NewThread<(lambda at /tmp/sourcepawn/vm/watchdog_timer.cpp:60:50)>' requested here
   60 |   thread_ = ke::NewThread("SourcePawn Watchdog", [this]() -> void {
      |                 ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/type_traits:2590:9: note: 'result_of<(lambda at /tmp/sourcepawn/vm/watchdog_timer.cpp:60:50) &()>' has been explicitly marked deprecated here
 2590 |     { } _GLIBCXX17_DEPRECATED_SUGGEST("std::invoke_result");
      |         ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/x86_64-linux-gnu/c++/13/bits/c++config.h:122:45: note: expanded from macro '_GLIBCXX17_DEPRECATED_SUGGEST'
  122 | # define _GLIBCXX17_DEPRECATED_SUGGEST(ALT) _GLIBCXX_DEPRECATED_SUGGEST(ALT)
      |                                             ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/x86_64-linux-gnu/c++/13/bits/c++config.h:98:19: note: expanded from macro '_GLIBCXX_DEPRECATED_SUGGEST'
   98 |   __attribute__ ((__deprecated__ ("use '" ALT "' instead")))
      |                   ^
1 error generated.
Build failed: libsourcepawn_static/linux-x86_64/vm/watchdog_timer.o
@peace-maker peace-maker added the bug label Jan 9, 2025
@Fyren
Copy link
Contributor

Fyren commented Jan 23, 2025

To say the same here as on Discord, this appears to be https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114394.

The gcc maintainer's comment is this is only fixed in 13.4's libstdc++ (I didn't try to check 14), so we could disable the warning on newer clang, switch to older clang, or amtl has to not use std::bind (perhaps pull the newer implementation from gcc as amtl::bind?).

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

Successfully merging a pull request may close this issue.

2 participants