[Uml-devel] is this correct for gcc 2.96 (fwd)
Tsuraan
grovenjl at rose-hulman.edu
Mon Apr 7 09:52:06 UTC 2003
> main()
> {
> enum TextFlags { Bold = 0x1, Italics = 0x2, Underline = 0x4 };
> TextFlags test;
>
> test = 0;
> }
>
> these constructs are being used in kdesdk/umbrello/umbrello/diagram and a
> similar construct is used in kdeaddons/noatun-plugins/dub/dub since last
> week which prevents me from compiling them.
> since gcc gives the following error
>
> [wdl at enterprise wdl]$ gcc test.cpp
> test.cpp: In function `int main ()':
> test.cpp:6: cannot convert `int' to `main ()::TextFlags' in assignment
Assuming that he's using the 3.2 compiler, the problem is that gcc 3.2 is much
more strict about type safety. What should work is
main() {
enum TextFlags { Bold = 0x1, Italics = 0x2, Underline = 0x4 };
TextFlags test;
test = TextFlags(0);
}
Since that will convert the int to the enum.
--jay
More information about the umbrello-devel
mailing list