[Uml-devel] is this correct for gcc 2.96 (fwd)
Jonathan Riddell
jr at jriddell.org
Mon Apr 7 10:00:06 UTC 2003
On Mon, 7 Apr 2003, Tsuraan wrote:
> > 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 subject suggests he's using 2.96
> 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.
That would be incorrect as it would assign a value to the test variable
which wasn't valid for that enum.
The problem has been fixed, you can follow the thread in kde-devel.
Jonathan
More information about the umbrello-devel
mailing list