Precompiled headers and General Parsing of Header File

Cotton Seed cottons@concmp.com
Fri Jul 31 09:50:00 GMT 1998


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



More information about the Gcc mailing list