[Mono-list] Strange compiler (mis)behaviour

Aleksandar Dezelin Aleksandar Dezelin <dezelin@gmail.com>
Tue, 22 Feb 2005 16:48:35 +0100

I get this error when I try to compile my application code:

*** Building TemplateConvertor.exe...
/usr/local/bin/mcs -g -d:DEBUG,TRACE -checked+ -L ./lib -t:exe
-out:./lib/TemplateConvertor.exe -r:System,System.Data,PassiveTypes
./src/TemplateConvertor/AccessTemplates.cs(98) error CS0172: Can not
compute type of conditional expression as `int' and `short' convert
implicitly to each other
Compilation failed: 1 error(s), 0 warnings

This is the problematic piece of code:

template.CompressionLevel is of type short.
template.CompressionLevel = (reader.IsDBNull(1)) ? 0 : reader.GetInt16(1);

why mcs compiler does not generate code like in the case the second line is:

template.CompressionLevel = (reader.IsDBNull(1)) ? (short)0 :

Aleksandar Dezelin

Linux is like wighwam, no windows no gates and apache inside...