File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -273,9 +273,29 @@ S s = t; // s.a is set to 3
273
273
----
274
274
)
275
275
276
- $(P If $(D opCall) is overridden for the struct, and the struct
277
- is initialized with a value that is of a different type,
278
- then the $(D opCall) operator is called:)
276
+ $(P If the struct has a $(LINK2 #struct-constructor, constructor), and
277
+ the struct is initialized with a value that is of a different type,
278
+ then the constructor is called:)
279
+
280
+ $(SPEC_RUNNABLE_EXAMPLE_RUN
281
+ ----
282
+ struct S
283
+ {
284
+ int a;
285
+
286
+ this(int v)
287
+ {
288
+ this.a = v;
289
+ }
290
+ }
291
+
292
+ S s = 3; // sets s.a to 3 using S's constructor
293
+ ----
294
+ )
295
+
296
+ $(P If the struct does not have a constructor but $(D opCall) is
297
+ overridden for the struct, and the struct is initialized with a value
298
+ that is of a different type, then the $(D opCall) operator is called:)
279
299
280
300
$(SPEC_RUNNABLE_EXAMPLE_RUN
281
301
----
You can’t perform that action at this time.
0 commit comments