http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57210
Bug #: 57210 Summary: Using alignas with an union does not compile. Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: damien.le...@gmail.com I have a construct of the form: template <unsigned int ALIGNMENT> class foo { /* ... */ private: alignas(ALIGNMENT) union bar_ { /* ... */ } bar; }; which does not compile with the following errors: error: 'ALIGNMENT' is not a type error: ISO C++ forbids declaration of 'alignas' with no type [-fpermissive] error: expected ';' at end of member declaration The following alternatives have been tried without success: /* ... */ union alignas(ALIGNMENT) bar_ { /* ... */ } bar; union bar_ { alignas(ALIGNMENT) int foo; /* ... */ } bar; /* ... */ With different but equivalent error messages.