-
-
Notifications
You must be signed in to change notification settings - Fork 606
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 #1181 from 9rnsr/fix8809
Issue 8809 - Cannot statically bind to base class method overridden by derived class
- Loading branch information
Showing
5 changed files
with
238 additions
and
112 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
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 |
---|---|---|
@@ -1,16 +1,43 @@ | ||
import core.stdc.stdio : printf; | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/fail61.d(22): Error: no property 'B' for type 'fail61.A.B', did you mean 'C'? | ||
fail_compilation/fail61.d(23): Error: no property 'B' for type 'fail61.A.B', did you mean 'C'? | ||
fail_compilation/fail61.d(32): Error: no property 'A2' for type 'fail61.B2' | ||
fail_compilation/fail61.d(41): Error: this for foo needs to be type B3 not type fail61.C3 | ||
--- | ||
*/ | ||
|
||
class A | ||
{ | ||
class B:A | ||
{ | ||
const int C = 5; | ||
} | ||
class B : A | ||
{ | ||
const int C = 5; | ||
} | ||
} | ||
|
||
void main() | ||
{ | ||
printf ("1 %d\n", A.B.C); | ||
printf ("2 %d\n", A.B.B.C); | ||
printf ("3 %d\n", A.B.B.B.C); | ||
int n1 = A.B.C; | ||
int n2 = A.B.B.C; // Line22 | ||
int n3 = A.B.B.B.C; // Line23 | ||
} | ||
|
||
class A2 { void foo(){ assert(0);} } | ||
class B2 : A2 { override void foo(){} } | ||
class C2 : B2 | ||
{ | ||
void bar() | ||
{ | ||
B2.A2.foo(); // Line32 | ||
} | ||
} | ||
|
||
class B3 { void foo(){ assert(0); } } | ||
class C3 | ||
{ | ||
void bar() | ||
{ | ||
B3.foo(); // Line41 | ||
} | ||
} |
Oops, something went wrong.