[Bug c++/50471] Qualified lookup fails to find template function
zoltan at epochcapital dot com.au
gcc-bugzilla@gcc.gnu.org
Wed Sep 21 06:44:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50471
--- Comment #2 from Zoltan Glozik <zoltan at epochcapital dot com.au> 2011-09-21 05:43:44 UTC ---
Comment on attachment 25330
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25330
bug
#include <iostream>
namespace NS {
template<class T>
struct A {
T t;
};
template<class T>
void f(T &t)
{
std::cout << "function 1" << std::endl;
}
template<class T>
void g1(T &t)
{
// qualify with namespace
NS::f(t);
}
template<class T>
void g2(T &t)
{
// do not qualify with namespace
f(t);
}
template<class T>
void f(A<T> &t)
{
std::cout << "function 2" << std::endl;
}
}
int main()
{
using namespace NS;
A<int> a;
g1(a); // this should print: "function 2", bug?
g2(a); // this prints "function 2" correctly.
return 0;
}
More information about the Gcc-bugs
mailing list