http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58109
Bug ID: 58109 Summary: alignas() fails to compile with constant expression Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: janezz55 at gmail dot com Created attachment 30626 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30626&action=edit file demonstrating bug The following example compiles without issue with clang++ 3.3: #include <cassert> #include <string> #include <type_traits> #include <typeinfo> #include <utility> namespace detail { template <typename A, typename ...B> struct max_align : std::integral_constant<std::size_t, (alignof(A) > max_align<B...>{}) ? alignof(A) : max_align<B...>{}> { }; template <typename A, typename B> struct max_align<A, B> : std::integral_constant<std::size_t, (alignof(A) > alignof(B)) ? alignof(A) : alignof(B)> { }; template <typename A> struct max_align<A> : std::integral_constant<std::size_t, alignof(A)> { }; }; template <typename ...T> struct test { alignas(::detail::max_align<T...>::value) char store_[10]; }; int main() { test<std::string, int> a; return 0; } But even with g++-4.9, it fails with: t.cpp:39:59: error: requested alignment is not an integer constant alignas(::detail::max_align<T...>::value) char store_[10];