I have a syntax error with cppcheck and using/typedef declarations. I have a struct that contains
struct inferior
{
using visitor = int;
template <typename T>
bool operator()(const T &a, const T &b) const
{
return a < b;
}
};
int main() {
return 0;
}
when I run cppcheck file.cpp
output is
[file.cpp:5]: (error) syntax error
with no further output.
The error disappeared if I remove the using
declaration.
I wonder if it's normal behaviour from cppcheck
. the using
declaration not being used directly. (It's a reduced example with a using
redefining int).
Some context if needed: In my application, the using
defines a specialisation of a visitor OnlyArithmetic
like so: using visitor = OnlyArithmetic<inferior>
that filters the non-arithmetic types using metaprogramming techniques, then I call std::visit on inferior::visitor(). I used this trick to not repeat the filtering part for all structures I need (inferior, superior, ...).
[EDIT] Using cppcheck 1.88