-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't report user operator error during probing user conversions. Fixes
- Loading branch information
1 parent
eb0d7ef
commit ff813f6
Showing
3 changed files
with
137 additions
and
18 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,57 @@ | ||
class MainClass | ||
{ | ||
static int Foo (double d) | ||
{ | ||
return 0; | ||
} | ||
|
||
static int Foo (int d) | ||
{ | ||
return 100; | ||
} | ||
|
||
public static int Main () | ||
{ | ||
decimal a = new A (); | ||
long b = new B (); | ||
if (b != 7) | ||
return 1; | ||
|
||
if (Foo (new B2 ()) != 100) | ||
return 1; | ||
|
||
return 0; | ||
} | ||
} | ||
|
||
public class A | ||
{ | ||
public static implicit operator int (A a) | ||
{ | ||
return 6; | ||
} | ||
} | ||
|
||
public class B : A | ||
{ | ||
public static implicit operator int (B b) | ||
{ | ||
return 7; | ||
} | ||
} | ||
|
||
public class A2 | ||
{ | ||
public static implicit operator double (A2 a) | ||
{ | ||
return 2; | ||
} | ||
} | ||
|
||
public class B2 : A2 | ||
{ | ||
public static implicit operator int (B2 b) | ||
{ | ||
return 3; | ||
} | ||
} |
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