This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 8385 - Implicit conversion means mono MCS cannot determine type of conditional
Summary: Implicit conversion means mono MCS cannot determine type of conditional
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2012-11-13 18:55 UTC by Brett van Swelm
Modified: 2012-11-14 07:17 UTC (History)
1 user (show)

See Also:
Is this bug a regression?: ---
Last known good build:


Description Brett van Swelm 2012-11-13 18:55:28 UTC
Implicit conversion means mono MCS cannot determine type of conditional, but MS
CSC can.

With "D:\Applications\Mono-2.11.4\bin" and
"C:\Windows\Microsoft.NET\Framework\v4.0.30319" in the path on my Windows 7

===== ImplicitConditional.cs =====
using System;

public class ImplicitConditional {
    public static int Test(bool condition, short value) {
        return condition ? -1 : value;
    public static void Main(String[] args) {}
===== end =====

Section "6.1.2 Implicit numeric conversions" of the C# language specification
does not list an implicit conversion from "int" to "short", so the MCS error
message is suspect.

$ csc ImplicitConditional.cs
Microsoft (R) Visual C# Compiler version 4.0.30319.17929
for Microsoft (R) .NET Framework 4.5
Copyright (C) Microsoft Corporation. All rights reserved.

$ mcs ImplicitConditional.cs
ImplicitConditional.cs(5,29): error CS0172: Type of conditional expression
cannot be determined as `int' and `short' convert implicitly to each other
Compilation failed: 1 error(s), 0 warnings


Brett van Swelm | Senior Engineer
Coverity | 185 Berry Street | Suite 6500, Lobby 3 | San Francisco, CA 94107
The Leader in Development Testing
Read our profile in Forbes, Coverity Gets Code Right 25% Faster
Comment 1 Marek Safar 2012-11-14 07:17:15 UTC
Fixed in master

Note You need to log in before you can comment on or make changes to this bug.