c++ - The simple example to reproduce the compiler error
- Christian Kaiser (41/41) Oct 05 2003 Hi Walter,
- Walter (1/1) Oct 05 2003 I'll check it out. Thanks. -Walter
Hi Walter,
below is an example of the code that does not compile. I marked the line and
the error text given by DMC. Maybe you find a workaround for that call.
(For Watcom the library programmer used a workaround: "clsNode<T>* p;
p->~clsNodeType<T>()" does not compile, but "NodeType* p; p->~NodeType()"
does; which is sanctioned by DMC with "Error: class name '?$clsNode H'
expected after ~"). I understand Matthew's statement about allowing
libraries to run with multiple compilers is more work than the code or
algorithm itself.
Thanks,
Christian
-----------------------------------
template <class T>
class clsNode
{
public:
inline clsNode(void) { }
inline ~clsNode(void) { }
};
template <class T>
class clsBase
{
protected:
typedef clsNode<T> NodeType;
public:
virtual ~clsBase(void)
{
}
void destruct(NodeType* p)
{
NodeType* pNode = p;
pNode->~clsNode<T>(); <<<<<<<<< "Error: '(' expected
following simple type name"
}
};
void f(void)
{
clsBase<int> Base;
clsNode<int> O;
Base.destruct(&O);
}
Oct 05 2003








"Walter" <walter digitalmars.com>