https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126282
Bug ID: 126282
Summary: Applying alignas with expanded parameter pack to a
struct does not change its alignment.
Product: gcc
Version: 16.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ernestoadamlugo at gmail dot com
Target Milestone: ---
Created attachment 65060
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65060&action=edit
The result of gcc -v -Wall -Wextra -Wpedantic snippet.cpp
Applying alignas w/ expanded parameter pack directly to a struct does not
change its alignment. This bug seems to apply for all versions of GCC since
6.1.
==========================================================================
#include <cstdint>
template <class... Ts> struct alignas(Ts...) not_working{ };
template <class... Ts> struct working{ alignas(Ts...) char m;};
// error: static assertion failed | the comparison reduces to '(1 == 4)`
static_assert(alignof(not_working<int, short, char>) == 4);
// fine
static_assert(alignof(working<int, short, char>) == 4);
==========================================================================