{"action":"opened","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/30298","repository_url":"https://api.github.com/repos/dotnet/roslyn","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/30298/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/30298/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/30298/events","html_url":"https://github.com/dotnet/roslyn/issues/30298","id":366559006,"node_id":"MDU6SXNzdWUzNjY1NTkwMDY=","number":30298,"title":"Bug with ternary ref assignment","user":{"login":"stephentoub","id":2642209,"node_id":"MDQ6VXNlcjI2NDIyMDk=","avatar_url":"https://avatars0.githubusercontent.com/u/2642209?v=4","gravatar_id":"","url":"https://api.github.com/users/stephentoub","html_url":"https://github.com/stephentoub","followers_url":"https://api.github.com/users/stephentoub/followers","following_url":"https://api.github.com/users/stephentoub/following{/other_user}","gists_url":"https://api.github.com/users/stephentoub/gists{/gist_id}","starred_url":"https://api.github.com/users/stephentoub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephentoub/subscriptions","organizations_url":"https://api.github.com/users/stephentoub/orgs","repos_url":"https://api.github.com/users/stephentoub/repos","events_url":"https://api.github.com/users/stephentoub/events{/privacy}","received_events_url":"https://api.github.com/users/stephentoub/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-03T22:48:17Z","updated_at":"2018-10-03T22:48:17Z","closed_at":null,"author_association":"MEMBER","body":"**Version Used**: \r\nVisual C# Compiler version 2.10.0.0 (750236a7)\r\n\r\n**Steps to Reproduce**:\r\n\r\nCompile with `csc /langversion:latest test.cs`:\r\n```C#\r\nusing System;\r\n\r\nclass Program\r\n{\r\n    static void Main()\r\n    {\r\n        Node x = new Node(), y = new Node();\r\n        bool flag = true;\r\n\r\n        ref Node n = ref x;\r\n        n = flag ? ref n.Left : ref n.Right;\r\n        n = y;\r\n\r\n        Console.WriteLine(x.Left);\r\n    }\r\n}\r\n\r\nclass Node { public Node Left, Right; }\r\n```\r\n\r\n**Expected Behavior**:\r\n\r\nOutputs:\r\n```\r\nNode\r\n\r\n```\r\ndue to x.Left being set to y.\r\n\r\n**Actual Behavior**:\r\n\r\nOutputs:\r\n```\r\n\r\n```\r\nempty lines, with x.Left remaining null.\r\n\r\nIf I instead change:\r\n```C#\r\nn = flag ? ref n.Left : ref n.Right;\r\n```\r\nto be:\r\n```C#\r\nif (flag)\r\n{\r\n    n = ref n.Left;\r\n}\r\nelse\r\n{\r\n    n = ref n.Right;\r\n}\r\n```\r\nthen it behaves as expected."}}
{"actor":{"display_login":"stephentoub"}}