Thread overview
[Issue 10524] New: case and with() isn't work together
Jul 02, 2013
mimocrocodil
Jul 14, 2013
yebblies
July 02, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10524

           Summary: case and with() isn't work together
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: 4denizzz@gmail.com


--- Comment #0 from mimocrocodil <4denizzz@gmail.com> 2013-07-01 17:56:12 PDT ---
struct S
{
    int field;
}

void main()
{
    int a = 1;
    S struct_with_long_name;

    switch( a )
    {
        case 0:
            struct_with_long_name.field = 444; // ok
            break;

        with( struct_with_long_name )
        {
            case 1:
                field = 555; // segfault
                break;
        }

        default:
            break;
    }
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 14, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10524


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies@gmail.com


--- Comment #1 from yebblies <yebblies@gmail.com> 2013-07-14 23:40:39 EST ---
This appears to work with 2.064 alpha on win32.  Can anybody reproduce?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 14, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10524


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc


--- Comment #2 from bearophile_hugs@eml.cc 2013-07-14 07:12:04 PDT ---
(In reply to comment #1)
> This appears to work with 2.064 alpha on win32.  Can anybody reproduce?

I can reproduce the segfault at the annotated line:


struct S {
   int field;
}
void main() {
   int a = 1;
   S s;
   switch (a) with (s) {
       case 0:
           s.field = 444; // ok
           break;
       case 1:
           field = 555; // segfault
           break;
       default:
           break;
    }
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------