10 Jun
2014
10 Jun
'14
12:14 p.m.
Peter Dimov wrote:
Yes, but T[] is an exception.
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.
When T is a complete object type, T[] is an array thereof, so it's allowed. I think.
Ah, I see. g++ appears to agree with the above (though, clang does not). Glen