www.digitalmars.com         C & C++   DMDScript  

c++ - [Bug report] Illegal cast

reply Daniel James <daniel calamity.org.uk> writes:
A change from the preprocessor bugs.

I think the following is valid:

     struct base
     {
     };

     struct derived : base
     {
     };

     struct convertible
     {
         operator derived() { return derived(); }
     };

     void test(base x)
     {
     }

     int main()
     {
         convertible x;
         test(x);
     }

But dmc gives the error message:

     slice.cpp(21) : Error: illegal cast
     from: derived
     to  : base

Daniel
Aug 12 2004
parent "Walter" <newshound digitalmars.com> writes:
Thanks for all the reports. I've added them to the bug list. -Walter
Aug 12 2004