J
John Collins
I just tried to build under GNU C++ 3.4.1 and then 3.4.3 a program which was
working fine under G++ 3.3.*
It uses template members "shm_cast" to obtain a pointer "foo *" to a
structure in shared memory from an offset "off" thus
template<typename T> T *shm_cast(const shmoff_t off) const
{
return static_cast<T*>(shmp(off));
}
used thus:
foo *item = seg.template shm_cast<foo>(off);
This is according to Stroustrup Appendix C13.6
If "template" is left out there it doesn't parse it right as was the case in
G++ 3.3.*.
It works fine with 3.3.* but with G++ 3.4.* it reports
error: `template' (as a disambiguator) is only allowed within templates
Please can anyone advise if G++ 3.4.* is broken or has some different syntax
been coined for this I haven't heard about.
Thanks if anyone can help.
working fine under G++ 3.3.*
It uses template members "shm_cast" to obtain a pointer "foo *" to a
structure in shared memory from an offset "off" thus
template<typename T> T *shm_cast(const shmoff_t off) const
{
return static_cast<T*>(shmp(off));
}
used thus:
foo *item = seg.template shm_cast<foo>(off);
This is according to Stroustrup Appendix C13.6
If "template" is left out there it doesn't parse it right as was the case in
G++ 3.3.*.
It works fine with 3.3.* but with G++ 3.4.* it reports
error: `template' (as a disambiguator) is only allowed within templates
Please can anyone advise if G++ 3.4.* is broken or has some different syntax
been coined for this I haven't heard about.
Thanks if anyone can help.