This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Bug in egcs g++


Hi!

I believe I've found a bug in egcs g++ related to typedef.

Criteria
--------
If the compiler produces an error message for valid input, that is a
compiler bug. 

I believe my input to be valid.  The compiler produces an error message.

Version
-------
/tmp$g++ -v
Reading specs from
C:/CYGNUS/CYGWIN~1/H-I586~1/BIN/../lib/gcc-lib/i586-cygwin32/egcs-2.91.66/sp
ecs
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)


Sample bug-producing file
-------------------------

--------------test.cpp begins--------------
//
// Testprogram to test typedef bug in egcs-2.91.66
//

#include    <stddef.h>

typedef void* MyVoidPtr;

class TestCls {
public:
   MyVoidPtr operator new ( size_t Size )
     { return (MyVoidPtr) new int[Size]; }
  void operator delete (MyVoidPtr address)
     { delete [] address;  };
};
--------------test.cpp ends--------------


command-line and output
-----------------------
/tmp$g++ test.cpp
test.cpp:12: `operator new' must return type `void *'
test.cpp:14: `operator delete' takes type `void *' as first parameter
/tmp$

type of machine
---------------
Win32 (Win95) CygWin B20.1 i386 (Pentium, actually).

operands to configure
---------------------
None -- I haven't changed the compiler from the CygWin B20.1 distribution.

Behavior that I believe is incorrect
------------------------------------
The compiler complains with two errors (see above under "command-line and
output").  Note that the problem seems to be only with new and delete, not
with any other member functions.  I believe that after

typedef void* MyVoidPtr;

"MyVoidPtr" and "void*" should be interchangable.  If this is not correct,
I repent in dust and ashes, lay my hand over my mouth, and apologize :-).



Best regards,

Ulrik Petersen
e-mail: ulrikp@daimi.au.dk



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]