[llvm-bugs] [Bug 10065] Bogus pedantic warning when using offsetof(type, field[n])

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Apr 5 06:43:34 PDT 2017


Aaron Ballman <aaron at aaronballman.com> changed:

           What    |Removed                     |Added
         Resolution|INVALID                     |---
             Status|RESOLVED                    |REOPENED
                 CC|                            |aaron at aaronballman.com

--- Comment #4 from Aaron Ballman <aaron at aaronballman.com> ---
This is WG14 DR 496. The committee discussion on the topic at the Markham 2017
meeting was that "structure member" should have said "subobject" instead, and
this is not actually intended to be an extension. Someone has volunteered to
draft new words to address this in C2x.

> 2. The standard says "member-designator" not "member".  It fails to define "member-designator".

The standard says:

"...which expands to an integer constant expression that has type size_t, the
value of which is the offset in bytes, to the structure member (designated by
member-designator), from the beginning of its structure (designated by type)."

member-designator is defined as the second operand to the ofsetof macro.

> 3. And anyway, stuff[99] is a member, just like x.y.z would be. :)

No, it is not, it is a subobject.

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/20170405/3847dde4/attachment-0001.html>

More information about the llvm-bugs mailing list