Skip to content

Commit 92ff7aa

Browse files
authored
Merge pull request #2457 from ghost91-/fix-issue-18104
Fix Issue 18104: improve example showing that aliases cannot be used … merged-on-behalf-of: Petar Kirov <ZombineDev@users.noreply.github.com>
2 parents 1eb3898 + d21b7c2 commit 92ff7aa

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

spec/declaration.dd

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -470,12 +470,17 @@ alias abc = foo.bar; // is it a type or a symbol?
470470
$(P Aliases cannot be used for expressions:)
471471

472472
-----------
473-
struct S { static int i; }
474-
S s;
473+
struct S
474+
{
475+
static int i;
476+
static int j;
477+
}
475478

476-
alias a = s.i; // illegal, s.i is an expression
477-
alias b = S.i; // ok
478-
b = 4; // sets S.i to 4
479+
alias a = S.i; // OK, `S.i` is a symbol
480+
alias b = S.j; // OK. `S.j` is also a symbol
481+
alias c = a + b; // illegal, `a + b` is an expression
482+
a = 2; // sets `S.i` to `2`
483+
b = 4; // sets `S.j` to `4`
479484
-----------
480485

481486
$(H2 $(LNAME2 extern, Extern Declarations))

0 commit comments

Comments
 (0)