Fix: cpp-common/bt2c/logging.hpp: add missing `template` keyword
In very specific contexts, it's possible that a `bt2c::Logger` reference
is a dependent type, for example:
template <typename T>
struct X
{
const bt2c::Logger& logger() const noexcept
{
return /* some logger reference */;
}
void log()
{
BT_CPPLOGI_SPEC(this->logger(), "Hello!");
}
};
In that case, the BT_CPPLOGI_SPEC() macro eventually expands to
something like:
this->logger().log<bt2c::Logger::Level::Info,
false>(__FILE__, __func__, __LINE__, "Hello!");
`this->logger()` is basically `X<T>::logger()`. Therefore, from the
log() method template point of view, the type of `this` depends on `T`,
that is, it's a dependent name. This example above won't build.
In that case, we need the `template` keyword to call the method:
this->logger().template log<bt2c::Logger::Level::Info,
false>(__FILE__, __func__,
__LINE__, "Hello!");
Using the `template` keyword or not would normally be a per-call
decision, but those BT_CPPLOG*() macros do the call themselves.
Knowing this, this patch adds the `template` keyword to all the logging
method calls from the BT_CPPLOG*() macros, just in case.
The current project builds because it doesn't have this specific
situation, but it could happen in the future.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I2847105746825d94cf71ed3abbd56fac0f160a2d
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12477
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
This page took 0.032359 seconds and 4 git commands to generate.