a compile-time, header-only, dimensional analysis and unit conversion library built on c++14 with no dependencies.
955
stars
135
forks
source link
A variable holding a unit initialized with the unary operator "-" cannot be constexpr #283
Closed
dsimonkay closed 2 years ago
units
version: 2.3.1 Compiler version: g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0I want to define a variable holding a negative number with a unit. The variable needs to be
constexpr
, as it will appear in astatic_assert
later on.The following code cannot be compiled:
The error:
When adding
constexpr
to the definition of the unary operator:The code can be compiled.