http://d.puremagic.com/issues/show_bug.cgi?id=5735
Summary: struct implicitly converted to boolean. Product: D Version: D1 & D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: ibuc...@ubuntu.com --- Comment #0 from Iain Buclaw <ibuc...@ubuntu.com> 2011-03-14 11:04:05 PDT --- Example code: struct A {} void foo(bool cond){} void main() { A a; int i; assert(a); // type A does not have a boolean value assert(i || a); // type A does not have a boolean value assert(0 || a); // OK if(a) {} // type A does not have a boolean value if(i || a) {} // type A does not have a boolean value if(0 || a) {} // type A does not have a boolean value foo(a); // cannot implicitly convert type A to bool foo(i || a); // OK foo(0 || a); // OK } The three examples that pass really should be errors. Regards -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------