[Issue 5862] New: case statement allows runtime values

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 19 13:26:23 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5862

           Summary: case statement allows runtime values
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2011-04-19 13:22:50 PDT ---
int foo(ref int y)
{
   y = 5;
   return y;
}

void main()
{
   int x = 1;
   int y = 2;

   switch (x = foo(y))
   {
       case y:  // <- should not be allowed
           writeln("x == y");
       default:
   }

   assert(x == 5);
   assert(y == 5);
}

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


More information about the Digitalmars-d-bugs mailing list