This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15631] Template instantiation can't see functions defined after template declaration.
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 May 2004 15:55:13 -0000
- Subject: [Bug c++/15631] Template instantiation can't see functions defined after template declaration.
- References: <20040524144702.15631.msharov@talentg.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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