Observed issue
==============
When compiling with GCC 4.8.5 or GCC 5.5.0 on SLES12SP5, the following
error happens:
```
save.cpp: In function 'int save_agent_events(config_writer*, agent*)':
save.cpp:1185:43: error: use of 'agent_event' before deduction of 'auto'
lttng::urcu::lfht_iteration_adapter<agent_event,
^ save.cpp:1185:43: error: use of 'agent_event' before deduction of 'auto'
save.cpp:1185:43: error: use of 'agent_event' before deduction of 'auto'
save.cpp:1187:26: error: template argument 1 is invalid
&agent_event::node>(*agent->events->ht)) {
^
save.cpp:1187:26: error: creating pointer to member of non-class type '<type error>'
save.cpp:1187:26: note: invalid template non-type parameter
In file included from ../../../src/vendor/fmt/core.h:3316:0,
from ../../../src/common/format.hpp:20,
from ../../../src/common/error.hpp:13,
from ../../../src/common/common.hpp:12,
from snapshot.hpp:13,
from consumer.hpp:12,
from session.hpp:11,
from kernel.hpp:13,
from save.cpp:10:
```
Cause
=====
This appears to be a limitation in older versions of GCC. I did not
find specific commit(s) or bugs which hilight the issue, but
compilation of this code works as of GCC 6.5.0 on SLES12SP5. Previous
point releases of GCC 6.x were not tested.
Solution
========
Explicitly define the type of the pointer and the type passed to
`lttng::urcu::lftht_iteration_adapter` so the compiler does not have
to perform type deduction.
Known drawbacks
===============
None.
Change-Id: I71c5937a38336756ece4f396ea5ba7af7f3d36c3
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
return;
}
- for (auto *agent :
- lttng::urcu::lfht_iteration_adapter<agent, decltype(agent::node), &agent::node>(
+ for (struct agent *agent :
+ lttng::urcu::lfht_iteration_adapter<struct agent, decltype(agent::node), &agent::node>(
*the_trigger_agents_ht_by_domain->ht)) {
const auto ret =
cds_lfht_del(the_trigger_agents_ht_by_domain->ht, &agent->node.node);
goto end;
}
- for (auto *agent_event :
- lttng::urcu::lfht_iteration_adapter<agent_event,
+ for (struct agent_event *agent_event :
+ lttng::urcu::lfht_iteration_adapter<struct agent_event,
decltype(agent_event::node),
&agent_event::node>(*agent->events->ht)) {
ltt_ust_event fake_event;