September 24, 2010 [Issue 4931] New: Implicit opCast!bool in if statement doesn't work with declarator | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=4931 Summary: Implicit opCast!bool in if statement doesn't work with declarator Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: patch Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: rsinfu@gmail.com --- Comment #0 from Shin Fujishiro <rsinfu@gmail.com> 2010-09-23 20:49:09 PDT --- Created an attachment (id=772) Patch against dmd r686 If an if statement has a variable declarator, a condition is implicitly converted to bool before its value is assigned to the declared variable. The following code doesn't compile: -------------------- void main() { if (S s = S()) {} // (3) } struct S { bool opCast(T : bool)() { return true; } } -------------------- % dmd -o- -c test.d test.d(3): Error: cannot implicitly convert expression (S().opCast()) of type bool to S -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 26, 2011 [Issue 4931] Implicit opCast!bool in if statement doesn't work with declarator | ||||
---|---|---|---|---|
| ||||
Posted in reply to Shin Fujishiro | http://d.puremagic.com/issues/show_bug.cgi?id=4931 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |k.hara.pg@gmail.com Resolution| |FIXED --- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2011-04-26 08:22:35 PDT --- Patch was already applied at https://github.com/D-Programming-Language/dmd/commit/69349699a8f770c6e06b440dfd1822c50826136a by Don Clugston. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation