My code more or less follows these lines:
Code: Select all
template <typename O>
class OT {};
class A{};
template <typename I, typename O>
class B : public A {
public:
OT<O> *obj;
};
template <typename O>
class B<void, O> : public A {
public:
OT<O> *obj;
};
template <typename O>
class C : public B<void, O> {
public:
function() {
obj->something();
}
};
Code: Select all
template <typename O>
class C : public B<void, O> {
public:
function() {
B<void, O>::obj->something();
}
};
Imo the compiler should accept the first, with the second being a resort in case of having two possible variables it could resolve to (with a warning of ambiguity with it). Am I wrong or is the GCC compiler wrong?
I'm using GCC version 3.4.6 compiled for x86, the one that's packaged with Slackware 10.2:
Configured with: ../gcc-3.4.6/configure --prefix=/usr --enable-shared --enable-threads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld --verbose --target=i486-slackware-linux --host=i486-slackware-linux
Thread model: posix
gcc version 3.4.6