Skip to content

Commit 5ad3364

Browse files
dkorpeldlang-bot
authored andcommitted
Mention scope attributes on class this
1 parent 3719b4c commit 5ad3364

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

spec/class.dd

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ $(H2 $(LNAME2 member-functions, Member Functions (a.k.a. Methods)))
234234

235235
$(P Non-static member functions can have, in addition to the usual
236236
$(GLINK2 function, FunctionAttribute)s, the attributes
237-
$(D const), $(D immutable), $(D shared), or $(D inout).
237+
$(D const), $(D immutable), $(D shared), $(D inout), $(D scope) or $(D return scope).
238238
These attributes apply to the hidden $(I this) parameter.
239239
)
240240
$(SPEC_RUNNABLE_EXAMPLE_FAIL
@@ -250,6 +250,10 @@ class C
250250
{
251251
a = 3; // error, 'this' is immutable
252252
}
253+
C bar() @safe scope
254+
{
255+
return this; // error, 'this' is scope
256+
}
253257
}
254258
---
255259
)

0 commit comments

Comments
 (0)