🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1088

Re: template feature

#1088
From: Mike Stump
Date: Fri, 06 Nov 1992 07:38
57 lines
1782 bytes
This problem and been fixed, and should not exist in the next release
of gcc.

> Message-Id: <9206260147.AA22392@AECL.ntt.jp>
> From: gennart@nttica.ntt.jp
> To: bug-gcc@prep.ai.mit.edu
> Cc: gennart@nttica.ntt.jp
> Date: Fri, 26 Jun 92 10:50:28 +0900

> info :
>     compiler : g++ version 2.2.1
>     command  : g++ tnp.c -o tnp
>     machine  : sparc2 sunOS 4.1.1

> The following program is a naive attempt at making
> an intrusive list. However, compilation causes
> the following error :

>     tnp.c:4: parse error before `>'

> Can somebody explain why it does not compile ?

> file : tnp.c
>   L1
>   L2    template <class Type>
>   L3    struct ListT {
>   L4       ListT<Type>* NextP ;             
>   L5       ListT (Type* objectP) ;
>   L6    } ;
>   L7 
>   L8    template <class Type>
>   L9    ListT<Type>::ListT (Type* objectP)
>  L10
>  L11    {
>  L12         NextP = 0 ;
>  L13    }
>  L14
>  L15    int main ()
>  L16
>  L17    {
>  L18        ListT<int> l (0) ;
>  L19    }
>  L20

> The problem can be formulated as follows. I can write
> easily the following type :

>     struct ObjectT {
>         ObjectT* NextP ;
>     } ;

> But if I want to make a template out of it, I cannot.

>     template<Type>
>     struct ListT {
>         ListT<Type>* NextP ;
>     }
Technical Details
Message-ID: <9211060738.AA27691@cygnus.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!emory!wupost!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cygnus.com!mrs

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!emory!wupost!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cygnus.com!mrs
From: mrs@cygnus.com (Mike Stump)
Newsgroups: gnu.g++.bug
Subject: Re:  template feature
Message-ID: <9211060738.AA27691@cygnus.com>
Date: 6 Nov 92 07:38:50 GMT
Article-I.D.: cygnus.9211060738.AA27691
Sender: gnulists@ai.mit.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 57
Approved: bug-g++@prep.ai.mit.edu