[Bug c++/43506] name lookup fails in function template

yao_yin at 163 dot com gcc-bugzilla@gcc.gnu.org
Mon Mar 29 01:56:00 GMT 2010



------- Comment #7 from yao_yin at 163 dot com  2010-03-29 01:56 -------
Sorry, I gave a wrong example..

In fact, the code in PR 29131:
template<class T>
int t(T i)
{
  return f (i);  // OK, with g++ 4.4.3
}

int
f (int i)
{
  return i;
}

int
main()
{
  return t(1);
}

can be compiled with g++ 4.4.3

but the following code cannot:

template<class T>
int f(int k, T i)
{
  return f(i);  // error: f not visible here
}

int
f (int i) // overload
{
  return i;
}

int
main()
{
  return f(1, 2);
}


-- 

yao_yin at 163 dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|DUPLICATE                   |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43506



More information about the Gcc-bugs mailing list