home/cconvey/r/cconvey/usml/usml/../usml/types/data_grid_svp.h:154:12: warning: 'usml::types::data_grid_svp::interpolate' hides overloaded virtual function [-Woverloaded-virtual]
154 | double interpolate(double* location, double* derivative = nullptr) const {
| ^
/home/cconvey/r/cconvey/usml/usml/../usml/types/gen_grid.h:83:15: note: hidden overloaded virtual function 'usml::types::gen_grid<3>::interpolate' declared here: type mismatch at 1st parameter ('const double *' vs 'double *')
83 | DATA_TYPE interpolate(const double location[],
| ^
My guess at what's happening:
Although we often treat them interchangeably, double* and double[] are in fact distinct types when used as function parameters, particularly w.r.t. overload resolution.
So in this case, your base class and derived class are actually defining different overloads of the interpolate method.
That's totally legal, but C++ programmers are often surprised by how this plays out in terms of (a) overload resolution, and (b) over-ridden / virtual methods. That's why this is a compiler warning rather than an error.
This gets into some of the gnarlier parts of the C++ spec, but here's some background:
Ideas
Would it make sense to just replace location[] with *location in these signatures? I'm not sure this would work, but it might be the easiest solution if it does.
As reported by
clang++-17 -Wall
:My guess at what's happening:
double*
anddouble[]
are in fact distinct types when used as function parameters, particularly w.r.t. overload resolution.interpolate
method.This gets into some of the gnarlier parts of the C++ spec, but here's some background:
Ideas Would it make sense to just replace
location[]
with*location
in these signatures? I'm not sure this would work, but it might be the easiest solution if it does.