|
 |
On Sat, 17 May 2008 10:36:31 +0200, Warp <war### [at] tag povray org> wrote:
> Sorry, I still don't understand this.
>
> I tried my foo-bar example making the bar() function a template which
> was
> specialized in one of the compilation units but not the other, and at
> least
> gcc still behave in the same way: When foo() was not inlined, only one
> version of bar() was called: The specialized version was never called.
Your foo-bar example is ill-formed. The compiler can do whatever it wants.
> From what you have written it sounds like the compiler would have to
> always call the specialized bar() template if it is in the context of
> the foo() instantiation, but at least gcc doesn't behave this way (and,
> frankly, I don't know *how* it could behave that way without seriously
> messing things up).
It is commonly called "two-phase lookup" (though it is not named as such
in the standard) and is explained in section 14.6 [temp.res] of the
standard. Section 14.6.4 [temp.dep.res] deals specifically with dependent
name resolution.
Compiler writers have been rather slow in implementing two-phase lookup
properly, almost as slow as with implementing 'export'.
--
FE
Post a reply to this message
|
 |