[Issue 21245] Error: expression `canBitwiseHash!(...)` of type `void` does not have a boolean value

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Sep 23 14:58:05 UTC 2020


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

Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |regression

--- Comment #1 from Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> ---
Amended test case which doesn't have invalid code:

/////////////////// test.d ///////////////////
struct Node
{
    NodePtr[] choices;

    void visit(Handler)(Handler h)
    {
        foreach (i, f; this.tupleof)
            if (h.handle(p => &p.tupleof[i]))
                return;
    }

    mixin AutoVisitor;
}

struct NodePtr
{
    mixin AutoVisitor;

    void visit(Handler)(Handler h)
    {
        h.handle(p => p);
    }
}

template AutoVisitor()
{
    hash_t toHash()
    {
        alias T = typeof(this);
        struct Handler
        {
            T* self;
            bool handle(F)(F* delegate(T*) dg)
            {
                auto a = dg(self);
                hashOf(*a);
                return true;
            }
        }
        visit!(Handler*)(null);
        return 0;
    }
}
//////////////////////////////////////////////

Seems to be a regression.
Introduced in https://github.com/dlang/druntime/pull/2240

--


More information about the Digitalmars-d-bugs mailing list