Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -2891,14 +2891,13 @@ Dsymbols *Parser::parseDeclarations(StorageClass storage_class, unsigned char *c
addComment(s, comment);
return a;
}
#if 0
/* Look for:
* alias this = identifier;
* alias this : identifier;
*/
if (token.value == TOKthis && peekNext() == TOKassign && peekNext2() == TOKidentifier)
if (token.value == TOKthis && peekNext() == TOKcolon && peekNext2() == TOKidentifier)
{
check(TOKthis);
check(TOKassign);
check(TOKcolon);
AliasThis *s = new AliasThis(loc, token.ident);
nextToken();
check(TOKsemicolon);
Expand All @@ -2907,7 +2906,6 @@ Dsymbols *Parser::parseDeclarations(StorageClass storage_class, unsigned char *c
addComment(s, comment);
return a;
}
#endif
/* Look for:
* alias identifier = type;
*/
Expand Down
6 changes: 3 additions & 3 deletions test/compilable/aliasdecl.d
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ void main()
static assert(is(Y4 == void delegate() const));
static assert(is(Y5.Type == int));

/+ struct S
struct S
{
int value;
alias this = value;
alias this : value;
}
auto s = S(10);
int n = s;
assert(n == 10); +/
assert(n == 10);
}