This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/15631] Template instantiation can't see functions defined after template declaration.


------- Additional Comments From bangerth at dealii dot org  2004-05-24 15:55 -------
No, when you call 
  ns1::size_of(x) 
in Base::print<T>, this is a fully qualified name and thus is not 
considered dependent. It is thus resolved at the time of template 
definition, not instantiation, and since there is no matching 
declaration of size_of available, the compiler needs to generate 
an error. 
 
The workaround you found is correct: write 
  using namespace ns1; 
  size_of(x); 
Here, the call is dependent and name lookup is deferred until instantiation 
time, at which time the correct overload of size_of is also found. 
 
Wolfgang 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15631


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]