This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
gcc bug ? accessing template function of a class object from another template class
- From: Suresh T <suresh dot t at philips dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 14 Feb 2006 18:20:51 +0530
- Subject: gcc bug ? accessing template function of a class object from another template class
hi
I am facing a problem accessing a template member function of class
(object ) from another template class
Is this a limitation of the gcc. Any workarounds ? suggestions ?. I am
using gcc ( ver > 3.2 )on linux .
Thanks for help
-----------------------------------------------------
More details below
-------------------------------------------------------
Note: Class outer has an instance of dummy. The read function of outer
calls the get function on the dummy instance
template <std::size_t sz>
class dummy {
public:
template<std::size_t ssz>
unsigned int get(unsigned int index) { }
};
template <std::size_t sz>
class outer{
public:
template<std::size_t ssz>
unsigned int read(unsigned int index)
{
return (static_cast<dummy_type >
(obj)).get<sz>(index);
}
typedef dummy<sz> dummy_type;
dummy_type obj;
};
>> Something like below in main does not work
int main() {
outer<32> o_obj;
std::cout<<"\n o_obj.read() :"<<o_obj.read<8>(1); //does not
work; results in a compilation error
}
---------------------------------------------------------------------------------------------------------
Warm Regards,
Suresh.T