Skip to content

Get around alignas bug in GCC 4.8

I ran into a bug with GCC 4.8 where if you use the alignas keyword with a number declared with a constexpr, it gives an error about the expression not being a constant expression (even though it is). A workaround to the issue is to wrap the alianas in a class templated by the size you want to align with. GCC does not complain when you use a constexpr with a template parameter, and it is happy to use that template parameter in the alignas expression.

Workaround found here: https://stackoverflow.com/questions/29879609/g-complains-constexpr-function-is-not-a-constant-expression

Merge request reports

Loading