Win32->Linux egcs-1.1.2 cross compiler temporary instance constructor with enum bug?

Artem Alimarine aalimari@best.ms.philips.com
Tue Oct 12 02:08:00 GMT 1999


>

Hello,


> ################# BEGIN ###################################################
>
> class Id
>   {
> public:
>   enum E
>     { ID };
>   };
>
> class C
>   {
> public:
>   C();
>   C(Id::E evalue);
>   };
>
> void    ActualInstance()
>   {
>   C   actual(Id::ID);
>   }
>

// needed for further demonstration
void f(const C&)
{
}


>
> void    TemporaryInstance()
>   {
> //  gcc -v reported:
> //  Reading specs from /xegcs/lib/gcc-lib/i586-linux-gnu/egcs-2.91.66/specs
> //  gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
>
> //  gcc -c tempobj.cpp reports:
> //  tempobj.cpp: In function `void TemporaryInstance()':
> //  tempobj.cpp:33: `class C Id::ID' is not a static member of `class Id'
>
>   C(Id::ID);  // it thinks it is the same as C Id::ID

//It does not work because it thinks it is a variable declaration of the form
type(var), just like
    int(a);  // same as int a;

//The following works as expected:

    f(C(Id::ID));


>
>   }
>
> ################# END ###################################################
>
> ------
> Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
> Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com

You say the other compilers work. It is interesting which is right. I do not know.

Artiom


More information about the crossgcc mailing list