http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56760
--- Comment #4 from erik.thi...@thiele-hydraulik.de 2013-03-28 07:58:00 UTC --- The example is reduced very much. Actually I have a module for "holder" and one for "contain" (separate compilation units). They do not know about each other. I have this global mechanism called "func" which everybody can make specializations for to enable his class to take part in this "func" stuff. What func does is serialize a class into the "binbuffer" binary buffer. If you create a custom class, you can let it take part in the "func" system and thus make it serializable. Everything works fine until I have a holder<contain<foo> > or a contain<holder<foo> >. The problem is that I cannot have a forward declaration because "contain" and "holder" don't know each other. This is like adding forward declarations in system libraries like "vector<>" for user classes which the STL developers of course cannot know. v2.cpp does not have the "nam" namespace that "v1.cpp" has. But the "nam" namespace is only for the "binbuffer" class. See that it has nothing to do with the "seco" namespace or the global namespace that "func" is inside. For that reason I do not understand why leaving out the "nam" namespace fixes the problem. I cannot find a workaround. The problem is that template implementations are inside headers. So either "holder" or "contain" is defined and implemented first. I cannot define "holder" and "contain" and then afterwards implement "holder" and "contain". This would fix my problem but then the template implementation cannot be inside the header anymore, at least I do not know how. I would need a precompiler that splits header interfaces from header implementations and first puts all interfaces and then all implementations. Is there another workaround? Sorry I do not understand your comment. Probably I miss some important point somehow. Anyway I do not find a solution...