[Bug c++/51316] New: alignof doesn't work with arrays of unknown bound

tsoae at mail dot ru gcc-bugzilla@gcc.gnu.org
Sat Nov 26 20:32:00 GMT 2011


             Bug #: 51316
           Summary: alignof doesn't work with arrays of unknown bound
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tsoae@mail.ru

gcc 4.7.0 rejects the following code:

    int main()
        // error: invalid application of '__alignof__' to incomplete type 'int
        alignof(int []);


    An alignof expression yields the alignment requirement of its operand type.
The operand shall be a type-id representing a complete object type or an array
thereof or a reference to a complete object type.

int[] is array of complete object type.

More information about the Gcc-bugs mailing list