Created on 2000-01-26.00:00:00 last changed 207 months ago
[Voted into WP at October 2005 meeting.]
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)
}
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.
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.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2008-10-05 00:00:00 | admin | set | status: wp -> cd1 |
| 2006-04-22 00:00:00 | admin | set | status: dr -> wp |
| 2005-10-22 00:00:00 | admin | set | messages: + msg1286 |
| 2005-10-22 00:00:00 | admin | set | status: ready -> dr |
| 2005-05-01 00:00:00 | admin | set | messages: + msg1139 |
| 2005-05-01 00:00:00 | admin | set | status: drafting -> ready |
| 2000-05-21 00:00:00 | admin | set | messages: + msg348 |
| 2000-05-21 00:00:00 | admin | set | status: open -> drafting |
| 2000-01-26 00:00:00 | admin | create | |