www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10121] New: Declarations before first case level in switch statement are allowed

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10121

           Summary: Declarations before first case level in switch
                    statement are allowed
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid, wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: maxim maxim-fomin.ru


--- Comment #0 from Maxim Fomin <maxim maxim-fomin.ru> 2013-05-19 12:32:41 PDT
---
extern(C) int printf(const char*, ...);

void main()
{
   switch(0)
   {
      int a = 4; // if immutable, prints 4
      case 0:
      printf("%d\n", a); //prints 0
   }
}

After the switch there is jump to zero case without proper initialization of
'a'.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 19 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10121


bearophile_hugs eml.cc changed:

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


--- Comment #1 from bearophile_hugs eml.cc 2013-05-19 16:12:50 PDT ---
Dupe of Issue 3820 ?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 19 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10121


Maxim Fomin <maxim maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


--- Comment #2 from Maxim Fomin <maxim maxim-fomin.ru> 2013-05-19 21:09:14 PDT
---
(In reply to comment #1)
 Dupe of Issue 3820 ?
Yes. *** This issue has been marked as a duplicate of issue 3820 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 19 2013