https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61987
Bug ID: 61987 Summary: Name Resolution within a Template Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gaoyuanming at hotmail dot com Created attachment 33222 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33222&action=edit Assembly code I compiled the piece of code: #include <stdlib.h> int foo(double d) { return static_cast<int>(d); } template <typename T> class Test { public: Test(int id, T const & value) : m_id(id), m_value(value) {} void change() { m_value = foo(m_id); } void change(int seed) { m_id = foo(m_value) * seed; } T value() const { return m_value; } private: int m_id; T m_value; }; int foo(int n) { return n; } int main() { Test<int> t(10, 20); t.change(); t.change(2); Test<unsigned long> tul(10, 30); tul.change(); tul.change(3); return 0; } and found that the function void Test<int>::change(int) calls int foo(double) to implement it. It is a bug.