www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17759] New: struct that attempts to implicitly cast away

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

          Issue ID: 17759
           Summary: struct that attempts to implicitly cast away const
                    causes segfault
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Mac OS X
            Status: NEW
          Keywords: ice, ice-on-valid-code
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: schveiguy yahoo.com

Consider the following struct which attempts to legally cast away const:

struct A
{
   int[] a;
   A foo() const { return A.init; }
   alias foo this;
}

The compiler segfaults, all the way back to 2.064. This is the minimum I could
do to make it happen. If you change anything, it seems to start compiling.

In LDC, it says "illegal instruction: 4"

If you use -v, I get this output:
predefs   DigitalMars Posix OSX darwin LittleEndian D_Version2 all D_SIMD
D_InlineAsm_X86_64 X86_64 D_LP64 D_PIC assert D_HardFloat
binary    dmd
version   v2.075.1
config    /Users/steves/.dvm/compilers/dmd-2.075.1/osx/bin/dmd.conf
parse     testimplicitmutable
importall testimplicitmutable
import    object   
(/Users/steves/.dvm/compilers/dmd-2.075.1/osx/bin/../../src/druntime/import/object.d)
import    core.attribute   
(/Users/steves/.dvm/compilers/dmd-2.075.1/osx/bin/../../src/druntime/import/core/attribute.d)
semantic  testimplicitmutable
semantic2 testimplicitmutable
semantic3 testimplicitmutable
Segmentation fault: 11

--
Aug 17