Fix "call of overloaded 'lerp' is ambiguous"
lerp function in src/shapes/metrics_path.cpp was causing an error:
error: call of overloaded ‘lerp(float&, const float&, float&)’ is ambiguous
/usr/include/c++/9/cmath:1919:3: note: candidate: ‘constexpr long double std::lerp(long double, long double, long double)’
1919 | lerp(long double __a, long double __b, long double __t) noexcept
| ^~~~
/usr/include/c++/9/cmath:1915:3: note: candidate: ‘constexpr double std::lerp(double, double, double)’
1915 | lerp(double __a, double __b, double __t) noexcept
| ^~~~
/usr/include/c++/9/cmath:1911:3: note: candidate: ‘constexpr float std::lerp(float, float, float)’
1911 | lerp(float __a, float __b, float __t) noexcept
| ^~~~
../submodule/rive-cpp/src/shapes/metrics_path.cpp:247:7: note: candidate: ‘float lerp(float, float, float)’
247 | float lerp(float from, float to, float f) { return from + f * (to - from); }
| ^~~~
ninja: build stopped: subcommand failed.
Function was renamed to calcLerp.
Does the error go away if you just mark the existing lerp() function as 'static' ?
@mikerreed Nope. Marking existing lerp() function as 'static' doesn't fix the problem. The problem is the usage of the function as there are multiple candidates, so I think renaming is the best choice. I added 'static' in the PR as the function is static but it is not essential.
Weird that it's resolving the std::lerp, I don't think we're explicitly using namespace std; but maybe that's because your platform is including cmath.h. What are you seeing this on? Would love to repro locally so we can add a test/callout for this.
we are unlikely to do a rename -- as that feels like running away for a larger problem -- we'd need to understand why your seeing this conflict while none of our configs see it, and then figure out where the actual problem is.