www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Bug 187] New: two errors meaning the same thing from assert(false, 1)

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=187

           Summary: two errors meaning the same thing from assert(false, 1)
           Product: D
           Version: 0.160
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: braddr puremagic.com


82     try
     83     {
     84         assert(false, 1);
     85     }
     86     catch (AssertError e)
     87     {
     88         writefln("message", e.message);
     89     }

assert-test.d:84: cannot implicitly convert expression (1) of type int to
char[]
assert-test.d:84: cannot cast int to char[]

Interestingly, a similar test only produces a single warning:

     91     int test7func() { return 1; }
     92     try
     93     {
     94         assert(false, test7func());
     95         writefln("test 7 failed -- it didn't throw when it should
have");
     96     }
     97     catch (AssertError e)
     98     {
     99         //writefln("test 7 assert msg: %s", e.message);
    100     }

assert-test.d:94: cannot implicitly convert expression ((test7func)()) of type
int to char[]


-- 
Jun 09 2006
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=187


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID





Cascaded errors often result when the compiler tries to guess at what was
intended in order to soldier on. If it guesses wrong, then another message will
usually come up later. Any error messages after the first should be taken with
a grain of salt. (The alternative is to quit after the first error, but most
find that unacceptable.)

The errors are correctly reported. Not a bug.


-- 
Jun 09 2006