[Issue 15366] Enum typed as bool behaves as bool even when cast

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Nov 20 13:09:59 PST 2015


https://issues.dlang.org/show_bug.cgi?id=15366

bb.temp at gmx.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bb.temp at gmx.com

--- Comment #1 from bb.temp at 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);
    }
} 
---

the error message seems totally meaningless when you consider func4.
func3 suggests that the real problem is that it needs a lvalue.

--


More information about the Digitalmars-d-bugs mailing list