This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Weird "shadow template parameter"


"Yuanfei guo" <yuanfei8077@gmail.com> 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@gmail.com> 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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]