From d3d4840e802ef6ee4353872401ded5cc5cf87ecb Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Thu, 20 Mar 2025 11:16:59 +0100 Subject: [gdb/build] Fix build with gcc 9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since commit a691853148f ("gdb/python: introduce gdbpy_registry"), when building gdb with gcc 9, I run into: ... In file included from gdb/varobj.c:38:0: gdb/python/python-internal.h:1211:47: error: expected ‘;’ before ‘<’ token using StorageKey = typename registry::key; ^ ... due to this code: ... template class gdbpy_registry { ... template using StorageKey = typename registry::key; template Storage *get_storage (O *owner, const StorageKey &key) const { ... } ... } ... As an experiment, I tried out eliminating the type alias: ... template Storage *get_storage (O *owner, const typename registry::key &key) const { ... } ... and got instead: ... In file included from gdb/varobj.c:38:0: gdb/python/python-internal.h:1211:63: error: non-template ‘key’ used as template Storage *get_storage (O *owner, const typename registry::key &key) const ^~~ gdb/python/python-internal.h:1211:63: note: use ‘registry::template key’ \ to indicate that it is a template ... Following that suggestion, I tried: ... template Storage * get_storage (O *owner, const typename registry::template key &key) const { ... } ... which fixed the problem. Likewise, adding the template keyword in the type alias fixes the original problem, so fix it like that. Tested on x86_64-linux. --- gdb/python/python-internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gdb/python/python-internal.h') diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index 5e67073..3f1a206 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -1208,7 +1208,7 @@ public: private: template - using StorageKey = typename registry::key; + using StorageKey = typename registry::template key; template Storage *get_storage (O *owner, const StorageKey &key) const -- cgit v1.1