public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Problem with forward declaration within a namespace...
@ 2002-04-19 11:50 Thomas J Amato
  2002-04-29 23:16 ` Alexandre Oliva
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas J Amato @ 2002-04-19 11:50 UTC (permalink / raw)
  To: gcc

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Problem with forward declaration within a namespace...
  2002-04-19 11:50 Problem with forward declaration within a namespace Thomas J Amato
@ 2002-04-29 23:16 ` Alexandre Oliva
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2002-04-29 23:16 UTC (permalink / raw)
  To: Thomas J Amato; +Cc: gcc

On Apr 19, 2002, "Thomas J Amato" <Thomas_J_Amato@raytheon.com> wrote:

> I was wondering if someone could tell me why this code fragment fails to
> compile under 3.0.3 (Solaris 2.7). 

> void* operator new(size_t, Arch::Allocator *const) throw(std::bad_alloc);

> new.hxx:21: type specifier omitted for parameter

Hmm...  Does using std::size_t make any difference?

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-04-30  5:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-19 11:50 Problem with forward declaration within a namespace Thomas J Amato
2002-04-29 23:16 ` Alexandre Oliva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).