Possible bug in GCC 3.0.3????

Thomas J Amato Thomas_J_Amato@raytheon.com
Mon Apr 22 04:18:00 GMT 2002


Hi,

I was wondering if someone could tell me why this code fragment fails to
compile under 3.0.3 (Solaris 2.7). We currently us the KAI compiler
(support for it is going away and we want to move to gcc) and this code
parses fine. Should putting the forward declaration in the namespace work
under gcc, or is this a bug (or not part of the standard)?

Any help would be great.

Thanks,

Tom

<<new.hxx>>
#ifndef NEW_HXX
#define NEW_HXX

#include <new>

  // Forward declaration.
namespace Arch { class Allocator; }

void* operator new(size_t, Arch::Allocator *const) throw(std::bad_alloc);
void* operator new(size_t, Arch::Allocator *const, const std::nothrow_t&)
throw();
void* operator new[](size_t, Arch::Allocator *const) throw(std::bad_alloc);
void* operator new[](size_t, Arch::Allocator *const, const std::nothrow_t&)
throw();

void operator delete(void*, Arch::Allocator *const) throw();
void operator delete(void*, Arch::Allocator *const, const std::nothrow_t&)
throw();
void operator delete[](void*, Arch::Allocator *const) throw();
void operator delete[](void*, Arch::Allocator *const, const
std::nothrow_t&) throw();

#endif // NEW_HXX

new.hxx:21: type specifier omitted for parameter
new.hxx:21: parse error before `*' token
new.hxx:21: `operator new' takes type `size_t' (`unsigned int') as first
parameter
new.hxx:22: type specifier omitted for parameter
new.hxx:22: parse error before `*' token
new.hxx:22: `operator new' takes type `size_t' (`unsigned int') as first
parameter
new.hxx:22: declaration of `void* operator new(unsigned int, ...) throw ()'
throws different exceptions
new.hxx:21: than previous declaration `void* operator new(unsigned int,
...) throw (std::bad_alloc)'
new.hxx:23: type specifier omitted for parameter
new.hxx:23: parse error before `*' token
new.hxx:23: `operator new' takes type `size_t' (`unsigned int') as first
parameter
new.hxx:24: type specifier omitted for parameter
new.hxx:24: parse error before `*' token
new.hxx:24: `operator new' takes type `size_t' (`unsigned int') as first
parameter






More information about the Gcc-help mailing list