Because there is some disagreement about the details of the template repository mechanism, you'll need to obtain a patch from Cygnus Support to enable the 2.7.2 repository code. You can obtain the patch by anonymous FTP: `ftp://ftp.cygnus.com/pub/g++/gcc-2.7.2-repo.gz'.
There are patches for 2.7.0 and 2.7.1 in the same directory, though if you're going to rebuild the compiler you should use the latest one.
If you're running NetBSD or BSDI, the Cygnus repo patch is not quite correct. Tim Liddelow has made an alternate version available at `ftp://ftp.cst.com.au/pub/gcc-2.7.2-repo-bsd.gz'.
After you've applied the patch, the -frepo
flag will enable the
repository mechanism. The flag works much like the existing
-fno-implicit-templates
flag, except that auxiliary files, with
an `.rpo' extension, are built that specify what template
expansions are needed. At link time, the (patched) collect program
detects missing templates and recompiles some of the object files
so that the required templates are expanded.
Note that the mechanism differs from that of cfront in that template definitions still must be visible at the point where they are to be expanded. No assumption is made that `foo.C' contains template definitions corresponding to template declarations in `foo.h'.
Jason Merrill writes: "To perform closure on a set of objects, just try to link them together. It will fail, but as a side effect all needed instances will be generated in the objects."