This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-11-11


1627. Agreement of dependent alignas specifiers

Section: 9.12.2  [dcl.align]     Status: NAD     Submitter: Richard Smith     Date: 2013-02-22

Although 9.12.2 [dcl.align] paragraph 6 requires that all declarations of a given entity must have the same alignment, enforcing that requirement for class templates would require instantiating all declarations of the template, a process not otherwise needed. For example:

   template<int M, int N> struct alignas(M) X;
   template<int M, int N> struct alignas(N) X {};

The same problem would presumably afflict any attribute applied to a class template.

Rationale (April, 2013):

9.12.2 [dcl.align] paragraph 6 requires that the alignments be “equivalent,” which in a dependent context is specified by 13.7.7.2 [temp.over.link] paragraph 5. The expressions in this example are not equivalent.