fork(2) download
  1. using System;
  2.  
  3. public struct S{
  4. public static S operator +(bool? b, S y)
  5. {
  6. return new S();
  7. }
  8.  
  9. public static S operator +(S x)
  10. {
  11. return new S();
  12. }
  13. }
  14.  
  15.  
  16. public class Test
  17. {
  18. public static void Main()
  19. {
  20. // the trick is to use the fact that the operator +
  21. // is both unary and binary.
  22. var o = 1 is bool? +new S() is int ? null : default(bool?);
  23. var p = 1 is bool? +new S() is int ? : default(bool?);
  24. }
  25. }
Success #stdin #stdout 0.01s 23192KB
stdin
Standard input is empty
stdout
Standard output is empty