File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ $(GNAME Attribute):
30
30
$(RELATIVE_LINK2 override, $(D override))
31
31
$(RELATIVE_LINK2 ref, $(D ref))
32
32
$(RELATIVE_LINK2 return, $(D return))
33
+ $(RELATIVE_LINK2 __rvalue, $(D __rvalue))
33
34
$(RELATIVE_LINK2 scope, $(D scope))
34
35
$(RELATIVE_LINK2 shared, $(D shared))
35
36
$(RELATIVE_LINK2 static, $(D static))
@@ -733,6 +734,10 @@ $(H2 $(LNAME2 return, $(D return) Attribute))
733
734
* $(DDSUBLINK spec/function, return-ref-parameters, Return Ref Parameters).
734
735
* $(DDSUBLINK spec/function, return-scope-parameters, Return Scope Parameters).
735
736
737
+ $(H2 $(LNAME2 __rvalue, $(D __rvalue) Attribute))
738
+
739
+ * $(DDSUBLINK spec/expression, __rvalue-function-attribute, $(I RvalueExpression)).
740
+
736
741
$(H2 $(LNAME2 static, $(D static) Attribute))
737
742
738
743
$(P The $(D static) attribute applies to types, functions and data.
Original file line number Diff line number Diff line change @@ -3596,6 +3596,23 @@ void oops()
3596
3596
3597
3597
$(P $(I RvalueExpression)s enable the use of $(I move constructor)s and $(I move assignment)s.)
3598
3598
3599
+ $(H4 $(LNAME2 __rvalue-function-attribute, As a function attribute))
3600
+
3601
+ $(P It is also allowed to use the $(CODE __rvalue) keyword as a function attribute. The presence of this
3602
+ attribute will infer the $(I RvalueExpression) upon the function call expression at the call-site,
3603
+ as if applied to the function's return value. This is only accepted on functions that return by reference.
3604
+ )
3605
+
3606
+ ---
3607
+ ref S fun(return ref S s) __rvalue
3608
+ {
3609
+ return s;
3610
+ }
3611
+
3612
+ S s;
3613
+ S t = fun(s); // call inferred as: __rvalue(fun(s))
3614
+ ---
3615
+
3599
3616
$(H3 $(LNAME2 specialkeywords, Special Keywords))
3600
3617
3601
3618
$(GRAMMAR
You can’t perform that action at this time.
0 commit comments