[Issue 20018] static foreach with static if and is should permit a declaration

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 10 06:53:55 UTC 2021


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

Mathias LANG <pro.mathias.lang at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pro.mathias.lang at gmail.com

--- Comment #1 from Mathias LANG <pro.mathias.lang at gmail.com> ---
Hit this today with the following code:
```D
bool hasLocalAliasing(Types...)()
{
    bool doesIt = false;
    static foreach (T; Types)
    {
        static if (is(T : Channel!CT, CT))
            doesIt |= true;
    }
    return doesIt;
}

class Channel (T) {}
static assert(!hasLocalAliasing!(Channel!(int), Channel!int));
```

Agree that this should not happen.

--


More information about the Digitalmars-d-bugs mailing list