This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-11-05
[Voted into WP at October 2005 meeting.]
The example in 13.8 [temp.res] paragraph 9 is incorrect, according to 13.8.4.2 [temp.dep.candidate] . The example reads,
void f(char);
template <class T> void g(T t)
{
f(1); // f(char);
f(T(1)); // dependent
f(t); // dependent
dd++; // not dependent
// error: declaration for dd not found
}
void f(int);
double dd;
void h()
{
g(2); // will cause one call of f(char) followed
// by two calls of f(int)
g('a'); // will cause three calls of f(char)
}
Since 13.8.4.2 [temp.dep.candidate]
says that
only Koenig lookup is done from the instantiation context, and since
6.5.4 [basic.lookup.argdep]
says that
fundamental types have no associated namespaces, either the example is
incorrect (and f(int) will never be called) or the
specification in 13.8.4.2 [temp.dep.candidate]
is incorrect.
Notes from 04/00 meeting:
The core working group agreed that the example as written is incorrect and should be reformulated to use a class type instead of a fundamental type. It was also decided to open a new issue dealing more generally with Koenig lookup and fundamental types.
(See also issues 213 and 225.)
Proposed resolution (April, 2005):
Change the example in 13.8 [temp.res] paragraph 9 as follows:
void f(char);
template <class T> void g(T t)
{
f(1); // f(char);
f(T(1)); // dependent
f(t); // dependent
dd++; // not dependent
// error: declaration for dd not found
}
enum E { e };
void f(intE);
double dd;
void h()
{
g(2e); // will cause one call of f(char) followed
// by two calls of f(intE)
g('a'); // will cause three calls of f(char)
}