Skip to content

Commit ee8e4ee

Browse files
authored
Merge pull request #2443 from jacob-carlborg/objc_offsetof_tupleof
Document that `.offsetof`/`.tupleof` are disabled for Objective-C classes merged-on-behalf-of: Mike Franklin <JinShil@users.noreply.github.com>
2 parents a5d8395 + acdf0b7 commit ee8e4ee

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

spec/class.dd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ $(H2 $(LNAME2 field_properties, Field Properties))
146146

147147
$(P The $(D .offsetof) property gives the offset in bytes of the field
148148
from the beginning of the class instantiation.
149+
`.offsetof` is not available for fields of `extern(Objective-C)` classes
150+
due to their fields having a dynamic offset.
149151
$(D .offsetof) can only be applied to
150152
expressions which produce the type of
151153
the field itself, not the class type:
@@ -172,6 +174,8 @@ $(H2 $(LNAME2 class_properties, Class Properties))
172174
$(DDSUBLINK spec/template, variadic-templates, expression sequence)
173175
of all the fields in the class, excluding the hidden fields and
174176
the fields in the base class.
177+
`.tupleof` is not available for `extern(Objective-C)` classes due to
178+
their fields having a dynamic offset.
175179
)
176180
---
177181
class Foo { int x; long y; }

0 commit comments

Comments
 (0)