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:33:31 +0000 (15:33 -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 0de713adc1a03f4affc48eda0efd03c1b7c1a470..bd35e8297e4c46b4dfc017501947aa5cd0fe2e85 100644 (file)
 #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.03038 seconds and 4 git commands to generate.