M
mojmir
Good morning,
i found small difference between gcc and visual studio when looking up
a
dependent name. Consider:
struct Base {
template<typename T, typename U>
void Implement (T t) { }
};
template<typename T, class BaseT>
struct Derived : BaseT {
template<typename U, typename V>
void foo (U u) {
//Implement<U,V>(u); // vs8, vs9 ok, gcc 3+ error
this->template Implement<U,V>(u); // vs ok, gcc ok
}
};
int main() {
Derived<int, Base> b;
b.foo<float, long>(1.0f);
}
It seems to me that gcc is right, because according standard the
Implement
method is a dependent name and therefore has to be accessed using this-
Mojmir
i found small difference between gcc and visual studio when looking up
a
dependent name. Consider:
struct Base {
template<typename T, typename U>
void Implement (T t) { }
};
template<typename T, class BaseT>
struct Derived : BaseT {
template<typename U, typename V>
void foo (U u) {
//Implement<U,V>(u); // vs8, vs9 ok, gcc 3+ error
this->template Implement<U,V>(u); // vs ok, gcc ok
}
};
int main() {
Derived<int, Base> b;
b.foo<float, long>(1.0f);
}
It seems to me that gcc is right, because according standard the
Implement
method is a dependent name and therefore has to be accessed using this-
, hasn't it?
Mojmir