[Issue 21380] compiler crashes when using auto ref

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 12 10:22:20 UTC 2020


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

Basile-z <b2.temp at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice
                 CC|                            |b2.temp at gmx.com
           Hardware|x86_64                      |All
                 OS|Linux                       |All
           Severity|critical                    |regression

--- Comment #1 from Basile-z <b2.temp at gmx.com> ---
regression from 2.073.2 (https://run.dlang.io/is/9fOvpM)
w/o phobos:

---
template isSomeFunction(T...)
if (T.length == 1)
{
    static if (is(typeof(& T[0]) U : U*) && is(U == function) || is(typeof(&
T[0]) U == delegate))
    {
        // T is a (nested) function symbol.
        enum bool isSomeFunction = true;
    }
    else static if (is(T[0] W) || is(typeof(T[0]) W))
    {
        // T is an expression or a type.  Take the type of it and examine.
        static if (is(W F : F*) && is(F == function))
            enum bool isSomeFunction = true; // function pointer
        else
            enum bool isSomeFunction = is(W == function) || is(W == delegate);
    }
    else
        enum bool isSomeFunction = false;
}

struct MySerializer (T)
{
        void serializeSinkType(T2) (scope auto ref T2 record) {}
}

template SupportSinkTypeSer(SerT)
{
        enum SupportSinkTypeSer =
isSomeFunction!(SerT.init.serializeSinkType!int);
}

int main()
{
        enum x = SupportSinkTypeSer!(MySerializer!int);
        return 0;
} 
---

--


More information about the Digitalmars-d-bugs mailing list