| Thread overview | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
November 20, 2015 [Issue 15366] Enum typed as bool behaves as bool even when cast | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15366 Lionello Lunesu <lio+bugzilla@lunesu.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-valid Severity|enhancement |normal -- | ||||
November 20, 2015 [Issue 15366] Enum typed as bool behaves as bool even when cast | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15366 bb.temp@gmx.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bb.temp@gmx.com --- Comment #1 from bb.temp@gmx.com --- That's funny because this compiles: --- enum Enum : bool { A, B } struct I{ void func(Enum e){} void func4(Enum a, Enum b) { (&func)(cast(Enum)(a && b)); } void func3(Enum a, Enum b) { Enum aa = cast(Enum)(a && b); func(aa); } } | ||||
November 20, 2015 [Issue 15366] Enum typed as bool behaves as bool even when cast | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15366 bb.temp@gmx.com changed: What |Removed |Added ---------------------------------------------------------------------------- Hardware|x86 |All OS|Mac OS X |All -- | ||||
November 21, 2015 [Issue 15366] Enum typed as bool behaves as bool even when cast | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15366 --- Comment #2 from Lionello Lunesu <lio+bugzilla@lunesu.com> --- Adding an explicit "this." fixed the issue: enum Enum : bool { A, B }; struct I{ void func(Enum e); void func2(Enum a, Enum b) {this.func(cast(Enum)(a&&b));} } Something happens when the compiler adds the "this" in your behalf. The resolution changes. -- | ||||
November 21, 2015 [Issue 15366] Enum typed as bool behaves as bool even when cast | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15366 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> --- https://github.com/D-Programming-Language/dmd/pull/5279 -- | ||||
November 21, 2015 [Issue 15366] Enum typed as bool behaves as bool even when cast | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15366 --- Comment #4 from github-bugzilla@puremagic.com --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/67a21a9ec222e63ad5bab445662de9114878bc90 fix Issue 15366 - Enum typed as bool behaves as bool even when cast >From a CastExp 'a && b', its `semantic` returns an `AndAndExp` with the 'Enum' type. But if its `semantic` will be called once more, it will repaint its `type` to 'bool'. Same problem exists in `OrOrExp`. https://github.com/D-Programming-Language/dmd/commit/913ffbe000e99e3a2aa6caaea9994a103503d6ac Merge pull request #5279 from 9rnsr/fix15366 Issue 15366 - Enum typed as bool behaves as bool even when cast -- | ||||
January 03, 2016 [Issue 15366] Enum typed as bool behaves as bool even when cast | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15366 --- Comment #5 from github-bugzilla@puremagic.com --- Commits pushed to stable at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/67a21a9ec222e63ad5bab445662de9114878bc90 fix Issue 15366 - Enum typed as bool behaves as bool even when cast https://github.com/D-Programming-Language/dmd/commit/913ffbe000e99e3a2aa6caaea9994a103503d6ac Merge pull request #5279 from 9rnsr/fix15366 -- | ||||
March 21, 2020 [Issue 15366] Enum typed as bool behaves as bool even when cast | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15366 Basile-z <b2.temp@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC|b2.temp@gmx.com | -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply