[Mono-list] enum broken
Jonathan Stowe
gellyfish@gellyfish.com
Sun, 7 Apr 2002 11:24:53 +0100 (BST)
On Sun, 7 Apr 2002, Paolo Molaro wrote:
> On 04/07/02 Jonathan Stowe wrote:
> > On further inspection it appears that it is something that WriteLine() is
> > doing:
> >
<snip>
> > int foo = 0 + Zub.Foo;
> >
<snip>
> > Works as expected. Interestingly however direct initialization of foo
>
> Unfortunately, no. This example should not compile: it's a bug in mcs.
> You can use:
> int foo = (int)Zub.Foo;
>
> to get the integer value of the enum.
>
> > from Zub.Foo fails to compile with:
>
> with:
> int foo = Zub.Foo;
> I get the correct:
>
> tests/enum-print.cs(12) error CS0029: Cannot convert implicitly from
> `Zub' to `int'
> Error: Compilation failed
>
This is my misunderstanding of the typing of enums, sorry.
> > (process:13688): ** WARNING **: unhandled exception
> > System.FormatException: "The specified format is invalid"
>
> Is this part of the trace where mcs calls Error()? If it died while
> reporting the compilation error in your code, you might want to check
> you corlib is uptodate with cvs. Error reporting works fine for me,
> but if you use a mcs from cvs and the corlib from the 0.10 release
> it may not work (I thinbk the format changes Gonzalo did landed in cvs
> only after the release).
Yeah, I figured that out :)
Anyhow I have subsequently tested this with csc and it does indeed behave
in the same way - this is infact a bug on page 34 of 'Programming C#' :)
/J\
--
Jonathan Stowe |
<http://www.gellyfish.com> | This space for rent
|