www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22329] New: DMD and LDC2 Segumentation Faults due to alias


          Issue ID: 22329
           Summary: DMD and LDC2 Segumentation Faults due to alias this on
                    private field + special names
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: msnmancini hotmail.com

That causes a sigsegfault on DMD without any error message
public struct Foo {
    private int values;
    alias values this;

void main()

If the values variable is changed to "values2", then, a compiler error is being

The mix of private and that special name causes an error,  jrfondren did a
brute force test case for every word that happens:

 Mayonix helped me tracking that bug too by getting to the conclusion 
"So when you name a private field some function defined in object.d, alias this
it, and then pass an object to a function in a different module which attempts
to access the alias this, it can't access the field in question because it's
private, so instead it finds the function defined in object.d,"

Sep 22 2021