nholthaus / units

a compile-time, header-only, dimensional analysis and unit conversion library built on c++14 with no dependencies.
http://nholthaus.github.io/units/
MIT License
964 stars 137 forks source link

Fix compile error under GCC-12 #309

Closed krf closed 1 year ago

krf commented 1 year ago

Fix ambiguous parse error in the following expression: if constexpr (PiRatio::num / PiRatio::den < 1 && PiRatio::num / PiRatio::den > -1)

GCC-12 apparently interprets PiRatio::den < 1 && PiRatio::num / PiRatio::den > as a template expression, which it shouldn't. Help disambiguating this expression by putting parentheses around the division.

Closes #306