1 2 3 4 5 6 7 8 9 10 11 12 13 | using System; class Program { public static void Write(short v) { } static void Main(string[] args) { Write(1);//ok Write((int)1);//ok int i=1; Write(i);//error!? } } |
CXVzaW5nIFN5c3RlbTsKCWNsYXNzIFByb2dyYW0KCXsKCQlwdWJsaWMgc3RhdGljIHZvaWQgV3JpdGUoc2hvcnQgdikgeyB9CgkJc3RhdGljIHZvaWQgTWFpbihzdHJpbmdbXSBhcmdzKQoJCXsKCQkJV3JpdGUoMSk7Ly9vawoJCQlXcml0ZSgoaW50KTEpOy8vb2sKCQkJaW50IGk9MTsKCQkJV3JpdGUoaSk7Ly9lcnJvciE/CgkJfQoJfQo=
prog.cs(10,25): error CS1502: The best overloaded method match for `Program.Write(short)' has some invalid arguments prog.cs(4,36): (Location of the symbol related to previous error) prog.cs(10,25): error CS1503: Argument `#1' cannot convert `int' expression to type `short' Compilation failed: 2 error(s), 0 warnings
-
result: Compilation error (maybe you wish to see an example for C#)


