https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90847
Bug ID: 90847 Summary: requested alignment is not an integer constant Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: zhonghao at pku dot org.cn Target Milestone: --- My gcc is 10.0.0, and the code is: template <int N> void test() { constexpr int N2 = N; typedef int T alignas(N2); // error: requested alignment is not an integer constant } int main() { test<4>(); return 0; } gcc accepts the code. clang rejects it: source>:4:16: error: 'alignas' attribute only applies to variables, data members and tag types typedef int T alignas(N2); ^ 1 error generated. Compiler returned: 1 icc gives a warning: <source>(4): warning #3463: alignas does not apply here typedef int T alignas(N2); ^ Compiler returned: 0