Title
offsetof macro and non-POD types
Status
cd1
Section
[support.types]
Submitter
Steve Clamage

Created on 2001-02-21.00:00:00 last changed 171 months ago

Messages

Date: 2010-10-21.18:28:33

[ Copenhagen: straw poll was 7-4 in favor. It was generally agreed that requiring a diagnostic was inadvertent, but some LWG members thought that diagnostics should be required whenever possible. ]

Date: 2010-10-21.18:28:33

Proposed resolution:

Change 18.1, paragraph 5, to "If type is not a POD structure or a POD union the results are undefined."

Date: 2001-02-21.00:00:00

Spliced together from reflector messages c++std-lib-8294 and -8295:

18.1, paragraph 5, reads: "The macro offsetof accepts a restricted set of type arguments in this International Standard. type shall be a POD structure or a POD union (clause 9). The result of applying the offsetof macro to a field that is a static data member or a function member is undefined."

For the POD requirement, it doesn't say "no diagnostic required" or "undefined behavior". I read [intro.compliance], paragraph 1, to mean that a diagnostic is required. It's not clear whether this requirement was intended. While it's possible to provide such a diagnostic, the extra complication doesn't seem to add any value.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg2185
2010-10-21 18:28:33adminsetmessages: + msg2184
2001-02-21 00:00:00admincreate