J
John Madsen
This bug is easier to just show than to explain I think...
namespace M {
template <class T> struct A {
void f(int a = T::foo()) { } // line 5
};
}
namespace N {
struct B {
static int foo() { return 5; }
};
}
int main() {
M::A<N::B> x;
x.f();
}
VC++ 7.1 (13.10.3077) produces the following diagnostic:
test.cpp(5) : error C2653: 'B' : is not a class or namespace name
test.cpp(5) : error C3861: 'foo': identifier not found, even with
argument-dependent lookup
Taking B out of namespace N makes it work, as does eliminating the
default parameter and providing an overload of A::f with no parameters
(which can serve a general workaround -- although it would be annoying
for constructors).
Both gcc 3.2 and Comeau 4.3.1 compile this code with no problem.
John
namespace M {
template <class T> struct A {
void f(int a = T::foo()) { } // line 5
};
}
namespace N {
struct B {
static int foo() { return 5; }
};
}
int main() {
M::A<N::B> x;
x.f();
}
VC++ 7.1 (13.10.3077) produces the following diagnostic:
test.cpp(5) : error C2653: 'B' : is not a class or namespace name
test.cpp(5) : error C3861: 'foo': identifier not found, even with
argument-dependent lookup
Taking B out of namespace N makes it work, as does eliminating the
default parameter and providing an overload of A::f with no parameters
(which can serve a general workaround -- although it would be annoying
for constructors).
Both gcc 3.2 and Comeau 4.3.1 compile this code with no problem.
John