Bug 60900

Summary: Error using implicit operator with Nullable
Product: [Mono] Compilers Reporter: Jonathan Chambers <joncham>
Component: C#Assignee: Marek Safar <masafa>
Severity: normal CC: mono-bugs+mono
Priority: ---    
Version: master   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Tags: Is this bug a regression?: ---
Last known good build:

Description Jonathan Chambers 2017-11-28 20:27:39 UTC
no error

Program.cs(8,21): error CS0266: Cannot implicitly convert type `Program.MyStruct?' to `int'. An explicit conversion exists (are you missing a cast?)
Compilation failed: 1 error(s), 0 warnings

Compile following code:

using System;

public class Program
    public static int Main(string[] args)
        int A = new MyStruct();
        // comment following line out and everything compiles fine
        int B = new Nullable<MyStruct> ();
        return 0;
    public struct MyStruct
        public static implicit operator int(Nullable<MyStruct> s) { return 0; }
Comment 1 Marek Safar 2017-12-22 14:46:14 UTC
Fixed in master