Re: Weird "shadow template parameter"

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

 



"Yuanfei guo" <yuanfei8077@xxxxxxxxx> writes:

> Can anyone please help shed some light on this question ?
> 
> Really need your guys' expertise on this.

Yes, the C++ standard prohibits this.

   [temp.local]: A template-parameter shall not be redeclared within its
   scope (including nested scopes).

Yes, you will have to change your code one way or another.

What you are trying to is rather odd.  You are trying to write
C1<T1><T2> where, because of the shadowing, C1 can not refer to T1.
Whhy do you want to do that?

Ian

> On 10/10/06, Yuanfei guo <yuanfei8077@xxxxxxxxx> wrote:
> > Hi,
> >
> > I found that compiling the following code will return the error
> > "shadow template parameter" .  Can anyone please confirm if this is a
> > GCC4.1 error or just another case  confirming to C++ standard more
> > closely ?  If it's not a bug, I wonder if there is any option I can
> > use to workaround this issue instead of changing my code ?
> >
> >
> > Template <class Type>
> > Class P1 {
> >        Template <class Type> //wrong
> >        Class C1{
> >        };
> > };
> >
> >
> > Thanks,
> > -Kelvin
> >

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux