POV-Ray : Newsgroups : povray.off-topic : A question about Java generics (not a flame) : Re: A question about Java generics (not a flame) Server Time
7 Sep 2024 19:12:15 EDT (-0400)
  Re: A question about Java generics (not a flame)  
From: Fredrik Eriksson
Date: 17 May 2008 05:52:26
Message: <op.ubalpng87bxctx@e6600.bredbandsbolaget.se>
On Sat, 17 May 2008 10:36:31 +0200, Warp <war### [at] tagpovrayorg> 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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.