[wpimath] Fix units overload resolution (#8267)

This commit is contained in:
Joseph Eng
2025-10-02 17:36:30 -07:00
committed by GitHub
parent ca7718cb08
commit 871769c815
2 changed files with 16 additions and 0 deletions

View File

@@ -3513,3 +3513,18 @@ TEST_F(CaseStudies, pythagoreanTheorum) {
pow<2>(RightTriangle::b::value()) ==
pow<2>(RightTriangle::c::value()));
}
TEST(Units, overloadResolution) {
// Slight hack to get nested functions
struct Scope {
static bool f(units::meter_t) {
return true;
};
static bool f(units::second_t) {
return false;
};
};
// Make sure this properly selects the meter overload
EXPECT_TRUE(Scope::f(1_mm));
}