[LLVMbugs] [Bug 19992] New: alignof(T[]) is not allowed

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jun 10 05:18:13 PDT 2014


            Bug ID: 19992
           Summary: alignof(T[]) is not allowed
           Product: clang
           Version: 3.4
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: glenfe at live.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Should alignof(T[]) be legal if T is a complete object type (and therefore T[]
is an "array thereof") according to the first statement in [expr.alignof]?

5.3.6 Alignof [expr.alignof]
1 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.
2 The result is an integral constant of type std::size_t.
3 When alignof is applied to a reference type, the result shall be the
alignment of the referenced type. When alignof is applied to an array type, the
result shall be the alignment of the element type.

I observed that g++ permits it.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140610/555c39d1/attachment.html>

More information about the llvm-bugs mailing list