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: Precompiled headers and General Parsing of Header File


Jason Merrill writes:
 >   void f (int);
 > 
 >   template <class T>
 >   void g (T)
 >   {
 >     f (1.0);
 >   }
 > 
 >   void f (double);
 > 
 >   main ()
 >   {
 >     g (24);
 >   }
 > 
 > Here, the call to f in g is bound immediately to f(int), since 1.0 does not
 > depend on T, even though at g's point of instantiation there is a better
 > match.  g++ actually doesn't get this right yet, but it's why we have to
 > parse templates immediately.

We do this by "dating" the scopes.  f(double) is not visible from
within g since the date of f(double) is older than that of the delayed
f in g.  Of course, this doesn't fix your problem of a non-reentrant
parser.

        - Cotton


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