bug-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

template inheritance from a class at different namespace


From: daniel
Subject: template inheritance from a class at different namespace
Date: Tue, 18 Jan 2005 18:17:12 +0100
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

Hi,
I use g++ (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-49)

Code1 returns these errors
   deleteme.cpp:33: `base' specified as declarator-id
   deleteme.cpp:33: two or more data types in declaration of `base'
deleteme.cpp:33: prototype for `int test<Namer>::base()' does not match any in
      class `test<Namer>'
   deleteme.cpp:26: candidate is: void test<Namer>::base()
deleteme.cpp:33: template definition of non-template `int test<Namer>::base()'

However, Code2 & Code3 work ok. Btw, Code1 works in MSVC++ 7.1
Is it as per design?

best regards

=Code1===============================
namespace spam {
   class base {};
}

   template<class Namer>
   class test
       : public spam::base
   {
   public:
       void base() ;
   };

   template<class Namer>
   void
   test<Namer>::base()
   {
       return NULL;
   }
int main(){}
=Code2===============================
namespace spam {
   class base {};
}

   class test
       : public spam::base
   {
   public:
       void base() ;
   };

   void
   test::base()
   {
   }
int main(){}

=Code3===============================
namespace spam {
   class base {};
}

   template<class Namer>
   class test
       : public spam::base
   {
   public:
       void base()  {}
   };

int main(){}

--
Daniel Piñol Laserna, Software Engineer

e-mail: address@hidden
phone:  +34 934 230 324
fax:    +34 933 251 028

SCYTL Online World Security
C. Entença 95 4-1
08015 Barcelona, Spain
http://www.scytl.com

NOTICE: The information in this e-mail and in any of its attachments is
confidential and intended solely for the attention and use of the named
addressee(s). If you are not the intended recipient, any disclosure,
copying, distribution or retaining of this message or any part of it,
without the prior written consent of SCYTL Online World Security, is
prohibited and may be unlawful. If you have received this in error,
please contact the sender and delete the material from any computer.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]