Hello everyone,


I am confused about what Bjarne means below, and I quoted the section name, his words and his sample.

My question is, what did he mean "A call that by coincidence has an argument that matches an actual template parameter type is not dependent"?

I think the compile error is because, g (1) function call is not dependent on template parameter, and it should be resolved in the definition phase (not instantiation phase) of template function f. But in definition phase of f, what g is (the symbol g) can not be resolved. So comes the compile error.

Is my analysis correct? What did Bjarne mean?

(section C.13.8.1 Dependent Names)

--------------------
A call that by coincidence has an argument that matches an actual template parameter type is not dependent. For example,
--------------------

Code:
template <class T> T f (T a)
{
	return g (1); // error: no g() in scope and g(1) doesn't depent on T
}

int g (int);

int z = f (2);

thanks in advance,
George