November 20, 2015 [Issue 15366] New: Enum typed as bool behaves as bool even when cast | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15366 Issue ID: 15366 Summary: Enum typed as bool behaves as bool even when cast Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: lio+bugzilla@lunesu.com enum Enum : bool { A, B }; struct I{ void func(Enum e); void func2(Enum a, Enum b) {func(cast(Enum)(a&&b));} //line 4 } test.d(4): Error: function test.I.func (Enum e) is not callable using argument types (bool) There are many changes to this code that will get rid of the error: * placing any one, or both, of the functions on global scope * using bitwise & instead of logic && * removing the type from the enum, or typing as byte/int/... -- |
Copyright © 1999-2021 by the D Language Foundation