public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Problems with templates
@ 2000-06-13  0:14 Hubert Felber
  2000-06-13  0:43 ` llewelly
  0 siblings, 1 reply; 3+ messages in thread
From: Hubert Felber @ 2000-06-13  0:14 UTC (permalink / raw)
  To: gcc-help

Hi,

Can anybody please help me?

I have problems compiling a nested template class, I get the error message:

Wrapper.h:10: declaration of 'class T'
Wrapper.h:6:   shadows template parm 'class T'

I am using g++ 2.95.2. Using another compiler on a non linux platform, this template compiles fine.

How can I change my code that it compiles fine with gcc 2.95.2 ?


Here is the snippet:


template <class T> class CWrapper  // line 6
{

  template <class T> class CCounted         //line 10
  {
    friend class CWrapper<T>;
  private:

    inline CCounted(T* pT) : Count(0), my_pT(pT) 
    {...  } 

    inline ~CCounted()
    {...}

    inline unsigned AddRef()
    { }
    inline unsigned Release() 
    {}

public:
    T* const my_pT;
  };
public:

  inline CWrapper(): m_pCounted(0) {}

  inline CWrapper(T* pT)
  {
    m_pCounted = new CCounted<T>(pT);
    m_pCounted->AddRef();
  }


.....

snipped the rest
....
private:


///////////////////////////////////////////////////////////////////////////////
  CCounted<T>* m_pCounted;

};


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

* Re: Problems with templates
  2000-06-13  0:14 Problems with templates Hubert Felber
@ 2000-06-13  0:43 ` llewelly
  0 siblings, 0 replies; 3+ messages in thread
From: llewelly @ 2000-06-13  0:43 UTC (permalink / raw)
  To: Hubert Felber; +Cc: gcc-help

On Tue, 13 Jun 2000, Hubert Felber wrote:

> Hi,
> 
> Can anybody please help me?

> 
> I have problems compiling a nested template class, I get the error message:
> 
> Wrapper.h:10: declaration of 'class T'
> Wrapper.h:6:   shadows template parm 'class T'
> 
> I am using g++ 2.95.2. Using another compiler on a non linux platform, this template compiles fine.
> 
> How can I change my code that it compiles fine with gcc 2.95.2 ?
> 
> Here is the snippet:
> 
> 
> template <class T> class CWrapper  // line 6
> {
> 
>   template <class T> class CCounted         //line 10
                   ^^
Change the name of  this template parameter.

>   {
>     friend class CWrapper<T>;
>   private:
> 
>     inline CCounted(T* pT) : Count(0), my_pT(pT) 
>     {...  } 
> 
>     inline ~CCounted()
>     {...}
> 
>     inline unsigned AddRef()
>     { }
>     inline unsigned Release() 
>     {}
> 
> public:
>     T* const my_pT;
>   };
> public:
> 
>   inline CWrapper(): m_pCounted(0) {}
> 
>   inline CWrapper(T* pT)
>   {
>     m_pCounted = new CCounted<T>(pT);
>     m_pCounted->AddRef();
>   }
> 
> 
> .....
> 
> snipped the rest
> ....
> private:
> 
> 
> ///////////////////////////////////////////////////////////////////////////////
>   CCounted<T>* m_pCounted;
> 
> };
> 
> 
> 

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

* Re: Problems with templates
@ 2000-06-13  0:46 Hubert Felber
  0 siblings, 0 replies; 3+ messages in thread
From: Hubert Felber @ 2000-06-13  0:46 UTC (permalink / raw)
  To: llewelly; +Cc: gcc-help

>>> <llewelly@dbritsch.dsl.xmission.com> 06/13/00 08:44am >>>
On Tue, 13 Jun 2000, Hubert Felber wrote:

> Hi,
> 
> Can anybody please help me?

> 
> I have problems compiling a nested template class, I get the error message:
> 
> Wrapper.h:10: declaration of 'class T'
> Wrapper.h:6:   shadows template parm 'class T'
> 
> I am using g++ 2.95.2. Using another compiler on a non linux platform, this template compiles fine.
> 
> How can I change my code that it compiles fine with gcc 2.95.2 ?
> 
> Here is the snippet:
> 
> 
> template <class T> class CWrapper  // line 6
> {
> 
>   template <class T> class CCounted         //line 10
                   ^^
<<Change the name of  this template parameter.

That's all? Uff.... Thanks for helping.

Hubert



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

end of thread, other threads:[~2000-06-13  0:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-13  0:14 Problems with templates Hubert Felber
2000-06-13  0:43 ` llewelly
2000-06-13  0:46 Hubert Felber

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).