home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / progc / fixed300.arj / DJB14912.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1991-04-26  |  804 b   |  51 lines

  1. #if 0
  2. From: Mike Finley
  3. Subject: Problem with new compiler (2.18)
  4. Date: Fri  4/01/91,  9:45 am
  5. Status: Fixed in 3.0
  6. #endif
  7.  
  8. class fred
  9. {
  10. public:
  11.    fred(int a);
  12.    ~fred();
  13. };
  14. class jim : public fred
  15. {
  16. public:
  17.    jim(): fred(0) {}
  18.    ~jim();
  19. };
  20. class test
  21. {
  22. public:
  23.    test( int a, fred *b) {}
  24.    test( float a, fred *b) {}
  25.    ~test();
  26. };
  27. main()
  28. {
  29. test *pTok, *pTfail;
  30.  jim  *pJ;
  31.  
  32.  pJ  =new jim;
  33.  
  34.  pTok= new test(0, (fred*)pJ);
  35. // Next line gives ambiguous reference to function
  36.  pTfail=new test(0, pJ);
  37.  
  38. // But page 324 of ARM says 0 is an int so an exact match. For the second
  39. // argument both require the same standard conversion.
  40.  
  41. return 0;
  42. }
  43.  
  44. /*
  45. (pTfail demonstrates the problem, which is failing to recognise a
  46. descendant class as valid)
  47.  
  48. mike
  49. */
  50.  
  51.