Skip to content
Discussion options

You must be logged in to vote

If my understanding of the spec is correct:

0 is int, therefore M(0) calls M(int).

default is not int or byte, int? or byte?, 0 and null are not int? or byte?, but all of them can be implicitly converted to the types, so they are resolved just like any other case where the expression converts to both types: the function whose parameter type implicitly converts to the parameter type of the other function is better.

spec:

6.4.5.3 Integer literals
The type of an integer literal is determined as follows:

  • If the literal has no suffix, it has the first of these types in which its value can be represented: int, uint, long, ulong.

6.4.5.7 The null literal
A null_literal represents a null val…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@ufcpp
Comment options

@CyrusNajmabadi
Comment options

Answer selected by ufcpp
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants