From: Andrew Burgess Date: Tue, 9 Dec 2025 10:34:11 +0000 (+0000) Subject: gdb: fix build error after forward_scope_exit changes X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1065ee0d94af7a72572d91f698307b7be065b4bc;p=thirdparty%2Fbinutils-gdb.git gdb: fix build error after forward_scope_exit changes After commit: commit 43db8f70d86b2492b79f59342187b919fd58b3dd Date: Thu Oct 23 16:34:20 2025 +0100 gdbsupport: remove undefined behaviour from (forward_)scope_exit A build failure was reported[1] when using clang++. The failure looks like this: CXX aarch64-fbsd-tdep.o In file included from /tmp/src/binutils-gdb/gdb/aarch64-fbsd-tdep.c:22: In file included from /tmp/src/binutils-gdb/gdb/gdbarch.h:28: In file included from /tmp/src/binutils-gdb/gdb/infrun.h:21: In file included from /tmp/src/binutils-gdb/gdb/gdbthread.h:35: /tmp/src/binutils-gdb/gdb/../gdbsupport/forward-scope-exit.h:112:20: error: too many template arguments for class template 'forward_scope_exit_policy' 112 | = scope_exit_base>; | ~~~~~~~~ /tmp/src/binutils-gdb/gdb/../gdbsupport/forward-scope-exit.h:82:8: note: template is declared here 81 | template | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 82 | struct forward_scope_exit_policy; | ^ The problem is that the forward_scope_exit_policy class expects 3 template arguments, but in forward-scope-exit.h we say: template using forward_scope_exit = scope_exit_base>; Which passes 4 template arguments. Fix this by changing the above 'using' like too: template using forward_scope_exit = scope_exit_base>; This now compiles with clang++. --- diff --git a/gdbsupport/forward-scope-exit.h b/gdbsupport/forward-scope-exit.h index fd93374afc9..35ef521de62 100644 --- a/gdbsupport/forward-scope-exit.h +++ b/gdbsupport/forward-scope-exit.h @@ -106,11 +106,10 @@ private: m_bind_function; }; -template +template using forward_scope_exit - = scope_exit_base>; + = scope_exit_base>; } /* namespace detail */