This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/39534] New: Template name lookup
- From: "anubhav dot saxena at wipro dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Mar 2009 03:01:13 -0000
- Subject: [Bug c++/39534] New: Template name lookup
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Hi,
I expect this code to print 2122 but it instead prints 2222.
#include <iostream>
using namespace std;
namespace my{
struct S{};
void f(S s, double d = 0){cout << "1";}
}
template<class T>
void h(){ T t; my::S s;
f(t, 0); // Line 1
f(s, 0); // Line 2
}
namespace my{ // reopen the namespace and add another overloaded function.
void f(S s, int d = 0){cout << "2";}
}
template<class T>
void g(){ T t; my::S s;
f(t, 0); // Line 3
f(s, 0); // Line 4
}
int main(){ h<my::S>();
g<my::S>();
Regards,
Anubhav.
--
Summary: Template name lookup
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: anubhav dot saxena at wipro dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39534