
"David Abrahams" <dave@boost-consulting.com> wrote
Any time a template is instantitated, all names in its definition must map to the same entities in each translation unit, or you violate the ODR. By definition, names in the unnamed namespace refer to distinct entities in each translation unit.
Does this mean that it's not allowed to use anonimous namespace-level names inside templates? I assume there also should be problems with non-template classes, too, if anonimous namespace-defined names are used inside the body of such a class... OTOH, you said "all names in its definition". Does this also mean "all names used to produce this definition"? Because if we use "typeof" inside such template, it would still resolve to the same type in different translation units (after all the metaprogramming used to produce this type is done). IOW, such templates in different translation units will be absolutely the same, although in each translation unit the compiler will have to instantiate different intermediate classes in order to produce them. Do you still think this should be a problem? Arkadiy