www.digitalmars.com         C & C++   DMDScript  

c++ - Compiler Error

The compiler (__DMC__ == 0x84x) is not able to handle the following program:

template < typename T > class A
{
public:
    virtual T get() const           { return T(5); }
};

template < typename T > class B : public A< T >
{
public:
    virtual T get() const           { return T(6); }
};

void foo()
{
    A< int >* a= new A< int >;
    B< int >* b= dynamic_cast< B< int >* >(a);      // <<-- Error
}


// command line options
// -c -Ic:\programme\dmars\include\win32;c:\programme\dmars\include -mn -ND 
-w- -5 -D_X86_=1 -D_WINDOWS -D_Windows -D__WIN32__ -D__MT__ -g- -DNDEBUG -W 
-Ar -Ab -Aw -Ae
Jun 15 2005