[Bug c++/15144] Template instantiation can't find symbol in global namespace
giovannibajo at libero dot it
gcc-bugzilla@gcc.gnu.org
Tue Apr 27 01:23:00 GMT 2004
------- Additional Comments From giovannibajo at libero dot it 2004-04-27 00:49 -------
Well, if I say T::baz the lookup is obviously deferred at instantiation time
because the name is dependent.
The point here is Koenig lookup. In templates, there is a special kind of
Koenig lookup which is evaluated at instantiation time. If you say "baz(x)"
where x is dependent, GCC will do a normal unqualified lookup of "baz" at
parsing time, and a Koenig lookup in the associated namespaces of "x" at
instantiation time. This is why the code works in that case. Instead, if you
say "::baz(x)" you disable Koenig lookup (which only applies to unqualified
names), so the only lookup performed is the one at parsing time: nothing is
found and an error is emitted.
I hope this clarifies the issue.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15144
More information about the Gcc-bugs
mailing list