http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59013
Bug ID: 59013 Summary: alignas rejects valid constant expressions Product: gcc Version: 4.9.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Blocks: 58601 template<int N> struct foo { static const unsigned value = 8; }; template<unsigned N> struct aligned_union { alignas(foo<N>::value) char data[N]; }; int main() { aligned_union<8> a; } aa.cc: In instantiation of ‘struct aligned_union<8u>’: aa.cc:15:22: required from here aa.cc:10:39: error: requested alignment is not an integer constant alignas(foo<N>::value) char data[N]; ^ This is wrong, foo<N>::value is an integer constant. The code is valid.