|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - The simple example to reproduce the compiler error
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
|