https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65685

            Bug ID: 65685
           Summary: Reducing alignment with alignas should be rejected
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
            Blocks: 58601

GCC doesn't give any diagnostic for the example in 7.6.2 [dcl.align] p5:

The combined effect of all alignment-specifiers in a declaration shall not
specify an alignment that is less strict than the alignment that would be
required for the entity being declared if all alignment-specifiers
appertaining to that entity were omitted. [ Example:
  struct alignas(8) S {};
  struct alignas(1) U {
    S s;
  };   // Error: U specifies an alignment that is less strict than
       // if the alignas(1) were omitted.
— end example ]

Reply via email to