You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can compile this code using gcc or the native platform in platformio, but I am getting an error when I build for the Teensy4.1:
template <typename T>
inline T saturate(T val, T lower, T upper)
{
T val1 = val > lower ? val : lower;
T val2 = val1 < upper ? val1 : upper;
return val2;
}
int main()
{
double v = 1.234;
saturate(v, 0.0, 90.0);
return 0;
}
The error I get is: src/exec/MainExec.cpp: In function 'int main()': src/exec/MainExec.cpp:12:26: error: no matching function for call to 'saturate(double&, float, float)' saturate(v, 0.0, 90.0);
Expected behavior: the compiler to make all three arguments doubles.
Is this a bug with the teensy platform or with the compiler?