When the compiler must store template instances, it stores them within the template repository corresponding to the output file. That is,
demo% CC -o sub/a.o a.cc
writes the object file to ./sub/a.o and writes template instances into the repository contained within ./sub/SunWS_cache. If the cache directory does not exist, and the compiler needs to instantiate a template, the directory is created for you.
You can specify an alternate repository location with the -ptrdirectory option.