www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - warning bug - assertions

reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Assertions should probably be treated as no-ops:

warnassert.d:
 int main()
 {
   assert(0);
   return 0;
 }

warning - warnassert.d(4): statement is not reachable And it doesn't matter if you use "-release" or not ? --anders
Mar 14 2005
parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
 Assertions should probably be treated as no-ops:
 
 warnassert.d:
 
 int main()
 {
   assert(0);
   return 0;
 }

warning - warnassert.d(4): statement is not reachable And it doesn't matter if you use "-release" or not ?

This, once again, makes the new DMD 0.119 fail to compile with warnings enabled - due to "assert(0)" before reaching the statement with the return value... See http://www.algonet.se/~afb/d/dmd-0.119-dwarn.patch (new), and http://www.algonet.se/~afb/d/dmd-0.118-dwarn.patch (old) I used the workaround of changing the "assert(0);" into "debug assert(0);". It really doesn't matter, since the default Phobos build strips all assertions... (I added a libphobos-contracts.a to the RPMS I built) IMHO; Phobos should compile with all warnings enabled ? -anders
Mar 18 2005