|
![](/i/fill.gif) |
On Thu, 15 May 2008 18:12:17 +0200, Warp <war### [at] tag povray org> wrote:
>> foo.cc:
>> export template<typename T>
>> void foo(T t) { bar(t); }
>
>> I see how that could make some difference.
>
> OTOH, thinking about it: There's no function named 'bar' defined
> anywhere in the scope of foo.cc, so why should that even compile?
'bar' is a dependent name, and must therefore be looked up in both the
definition context and the instantiation context.
> I have to admit I don't know if the C++ standard requires the
> environment of the instantation of the template when compiling the
> template function or not.
When parsing the template definition, only non-dependent names are looked
up. Dependent names are looked up at the instantiation point; at that
point both contexts are needed.
--
FE
Post a reply to this message
|
![](/i/fill.gif) |