www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3144] New: Invalid break accepted

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

           Summary: Invalid break accepted
           Product: D
           Version: 2.031
          Platform: All
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: tim.matthews7 gmail.com


This break statement causes program to exit:

import std.stdio;

void main()
{
    int i = 1;
    switch (i)
       case 1: writeln("1"); break;


    writeln("exit");

}


It should instead report "Error: break is not inside a loop or switch" like it
does for this code:

void main()
{
   break; 
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 06 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3144


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies gmail.com
            Version|2.031                       |D1 & D2
         AssignedTo|nobody puremagic.com        |yebblies gmail.com
         OS/Version|Windows                     |All



This is a parser bug, from what I can tell.  dmd assumes that the statements
inside a switch block are terminated with a '}', which isn't the case here.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 29 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3144


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch



https://github.com/D-Programming-Language/dmd/pull/660

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 29 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3144




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/c345b379a40280158a31fd041a30b7eb3962bbbf
fix Issue 3144 - Invalid break accepted

https://github.com/D-Programming-Language/dmd/commit/86a378bc33aa0698e3245a04088449315ae0b852


Another fix for Issue 3144 - Invalid break accepted

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 27 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3144


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|D1 & D2                     |D1
            Summary|Invalid break accepted      |(D1 only) Invalid break
                   |                            |accepted



Fixed D2

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 27 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3144


Kenji Hara <k.hara.pg gmail.com> changed:

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



Fixed D1:
https://github.com/D-Programming-Language/dmd/commit/9e72dad3ebba6f4e1e55e5aba01a5e654e9c39c9

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