This is the mail archive of the gcc@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]

Re: quick question


> You notice the variable v in the template function test1() is undeclared.

I see. This is a known (to everybody else, at least) bug in gcc.

> Is there an option which I can use to force the compiler to examine all the
> codes?

For templates in C++, there are names that depend on template
parameters and names that don't. In your example, v was not a
dependent name, so it should have been bound at the time of
declaration.

g++ currently binds names at the time of instantiation, which is when
you get the error. There is no work-around for that, sorry.

Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]