www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21380] New: compiler crashes when using auto ref

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

          Issue ID: 21380
           Summary: compiler crashes when using auto ref
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: feco.graczer gmail.com

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;
}

crashes compiler DMD64 D Compiler v2.094.0

with


(/lib/x86_64-linux-gnu/libLLVM-10.so.1+0x9814ff)

(/lib/x86_64-linux-gnu/libLLVM-10.so.1+0x97f782)


(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)

_D3dmd10dinterpret13ctfeInterpretFCQBh10expression10ExpressionZQBd
(/home/dan/dev/thirdparty/install-ldc-latest/bin/ldc2+0x3c425f)

_D3dmd9dtemplate16TemplateInstance14semanticTiargsFKxSQCa7globals3LocPSQCr6dscope5ScopePSQDj4root5array__T5ArrayTCQEiQz10rootobject10RootObjectZQBmiZb
(/home/dan/dev/thirdparty/install-ldc-latest/bin/ldc2+0x26e7ef)

(/home/dan/dev/thirdparty/install-ldc-latest/bin/ldc2+0x394406)

_D3dmd7initsem9inferTypeFCQy4init11InitializerPSQBu6dscope5ScopeZ8visitExpMFCQCxQCa14ExpInitializerZQCx
(/home/dan/dev/thirdparty/install-ldc-latest/bin/ldc2+0x352a80)

_D3dmd7initsem9inferTypeFCQy4init11InitializerPSQBu6dscope5ScopeZQBo
(/home/dan/dev/thirdparty/install-ldc-latest/bin/ldc2+0x352655)

(/home/dan/dev/thirdparty/install-ldc-latest/bin/ldc2+0x3f4061)

_D3dmd9dtemplate16TemplateInstance13expandMembersMFPSQBz6dscope5ScopeZv
(/home/dan/dev/thirdparty/install-ldc-latest/bin/ldc2+0x3ee132)

_D3dmd10dsymbolsem24templateInstanceSemanticFCQBs9dtemplate16TemplateInstancePSQCz6dscope5ScopePSQDr4root5array__T5ArrayTCQEq10expression10ExpressionZQBkZv
(/home/dan/dev/thirdparty/install-ldc-latest/bin/ldc2+0x3e4ec9)

(/home/dan/dev/thirdparty/install-ldc-latest/bin/ldc2+0x39446a)

_D3dmd7initsem9inferTypeFCQy4init11InitializerPSQBu6dscope5ScopeZ8visitExpMFCQCxQCa14ExpInitializerZQCx
(/home/dan/dev/thirdparty/install-ldc-latest/bin/ldc2+0x352a80)

_D3dmd7initsem9inferTypeFCQy4init11InitializerPSQBu6dscope5ScopeZQBo
(/home/dan/dev/thirdparty/install-ldc-latest/bin/ldc2+0x352655)

(/home/dan/dev/thirdparty/install-ldc-latest/bin/ldc2+0x3f4061)

(/home/dan/dev/thirdparty/install-ldc-latest/bin/ldc2+0x39ed42)

(/home/dan/dev/thirdparty/install-ldc-latest/bin/ldc2+0x2798df)

(/home/dan/dev/thirdparty/install-ldc-latest/bin/ldc2+0x27a29a)

(/home/dan/dev/thirdparty/install-ldc-latest/bin/ldc2+0x2a9f3a)

(/home/dan/dev/thirdparty/install-ldc-latest/bin/ldc2+0x2a82cf)

const*>&) (/home/dan/dev/thirdparty/install-ldc-latest/bin/ldc2+0x31f3fc)

(/home/dan/dev/thirdparty/install-ldc-latest/bin/ldc2+0x5621f2)

(/lib/x86_64-linux-gnu/libdruntime-ldc-shared.so.90+0xba9dc)

(/lib/x86_64-linux-gnu/libdruntime-ldc-shared.so.90+0xba7ef)

(/lib/x86_64-linux-gnu/libdruntime-ldc-shared.so.90+0xba65e)

(/home/dan/dev/thirdparty/install-ldc-latest/bin/ldc2+0x23b535)

/build/glibc-YYA7BZ/glibc-2.31/csu/../csu/libc-start.c:342:3

(/home/dan/dev/thirdparty/install-ldc-latest/bin/ldc2+0x23dabe)
Segmentation fault (core dumped)
ldc2 failed with exit code 139.

workaround is to remove the auto keyword, in that case it compiles...

--
Nov 12 2020