static_assert of const Variable
问题 I have this code: const float foo = 5.0F; static_assert(foo > 0.0F, "foo must be greater than 0."); But in visual-studio-2010 I get the error: error C2057: expected constant expression I'm actually doing this correctly and visual-studio-2010 just hasn't properly implemented static_assert , right? In visual-studio-2017 it works as intended. There has been some commentary of the differences between const and constexpr . I understand this difference, however many compilers support this use of