E
ES Kim
Please consider this code:
void foo(int);
template<typename T>
struct S
{
void f()
{
foo(1); // (1)
T t;
foo(t); // (2)
}
};
void foo(int*);
// <--- point of instantiation
int main()
{
S<int*> a;
a.f();
}
In (1), foo is not a dependent name, so point of definition binding applies
and void foo(int) is called. But what about (2)? I think foo IS a dependent
name there and point of instantiation binding applies. At that point,
void foo(int*) is in scope, which means the code has no problem.
But Comeau rejects the code. Is it correct or not?
void foo(int);
template<typename T>
struct S
{
void f()
{
foo(1); // (1)
T t;
foo(t); // (2)
}
};
void foo(int*);
// <--- point of instantiation
int main()
{
S<int*> a;
a.f();
}
In (1), foo is not a dependent name, so point of definition binding applies
and void foo(int) is called. But what about (2)? I think foo IS a dependent
name there and point of instantiation binding applies. At that point,
void foo(int*) is in scope, which means the code has no problem.
But Comeau rejects the code. Is it correct or not?