Fix: missing typename in URCU_FORCE_CAST
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 30 Jul 2024 19:21:07 +0000 (19:21 +0000)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 30 Jul 2024 19:32:20 +0000 (15:32 -0400)
When using rcu_dereference() in the method of a templated class on a pointer
whose type is determined by the template arguments, the following error occurs
(using g++ 13.2.0):

  ../../src/common/urcu.hpp:387:39: error: need 'typename' before 'std::remove_cv<__typeof__ (((lttng::urcu::rcu_list_iteration_adapter<ContainedType, Member>::iterator*)this)->_node_contents.next)>::type' because 'std::remove_cv<__typeof__ (((lttng::urcu::rcu_list_iteration_adapter<ContainedType, Member>::iterator*)this)->_node_contents.next)>' is a dependent scope

`typename` is necessary here since the result of the template argument provided
to std::remove_cv can be a dependant type and we are required to inform the
compiler of this dependency.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I209fc5f46fee372bf673fc04c5a55d4827238b19

include/urcu/compiler.h

index 197656c617d786f8af88f5648a60483ac224f3c4..31a474c9c86c2d9af1f118fccedc18f40d6faff0 100644 (file)
@@ -99,7 +99,7 @@
 #define __rcu
 
 #ifdef __cplusplus
-#define URCU_FORCE_CAST(_type, arg)    (reinterpret_cast<std::remove_cv<_type>::type>(arg))
+#define URCU_FORCE_CAST(_type, arg)    (reinterpret_cast<typename std::remove_cv<_type>::type>(arg))
 #else
 #define URCU_FORCE_CAST(type, arg)     ((type) (arg))
 #endif
This page took 0.027276 seconds and 4 git commands to generate.