Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5196 from 9rnsr/fix15209
Issue 15209 - redundant error message on invalid field access
- Loading branch information
Showing
2 changed files
with
22 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/diag15209.d(18): Error: need 'this' for 'x' of type 'int' | ||
fail_compilation/diag15209.d(21): Error: need 'this' for 'x' of type 'int' | ||
--- | ||
*/ | ||
|
||
class C1 { int x; } | ||
struct S1 { alias y = C1.x; } | ||
|
||
struct S2 { int x; } | ||
class C2 { alias y = S2.x; } | ||
|
||
void main() | ||
{ | ||
S1 s1; | ||
s1.y = 10; // invalid field variable access | ||
|
||
auto c2 = new C2(); | ||
c2.y = 10; // invalid field variable access | ||
} |