Bug 187 – two errors meaning the same thing from assert(false, 1)

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-06-09T03:31:00Z
Last change time
2014-02-15T13:21:33Z
Assigned to
bugzilla
Creator
braddr

Comments

Comment #0 by braddr — 2006-06-09T03:31:23Z
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[]
Comment #1 by bugzilla — 2006-06-09T03:43:15Z
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.