Skip to content

Commit

Permalink
fix Issue 2495 - const syntax for member functions needs better descr…
Browse files Browse the repository at this point in the history
…iption
  • Loading branch information
WalterBright committed Jan 23, 2012
1 parent 8ae9018 commit ad5b50b
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion class.dd
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,24 @@ void test(Foo foo) {
can be accessed.
)

$(V2
$(P Non-static member functions can have, in addition to the usual
$(GLINK2 declaration, FunctionAttribute)s, the attributes
$(D const), $(D immutable), $(D shared), or $(D inout).
These attributes apply to the hidden $(I this) parameter.
)
---
class C {
int a;
const void foo() {
a = 3; // error, 'this' is const
}
void foo() immutable {
a = 3; // error, 'this' is immutable
}
---
)

<h3>$(LNAME2 synchronized-functions, Synchronized Functions)</h3>

$(P Synchronized class member functions have the storage class
Expand Down Expand Up @@ -1170,7 +1188,7 @@ new ($(I ArgumentList)) $(I Identifier) ($(I ArgumentList));
)

$(V2
$(SECTION3 <a name="ConstClass">Const, Immutable and Shared Classes</a>,
$(SECTION3 <a name="ConstClass">Const Immutable and Shared Classes</a>,
$(P If a $(I ClassDeclaration) has a $(CODE const), $(CODE immutable)
or $(CODE shared) storage class, then it is as if each member of the class
was declared with that storage class.
Expand Down

0 comments on commit ad5b50b

Please sign in to comment.