Thread overview
[Issue 3144] New: Invalid break accepted
Jan 30, 2012
yebblies
Jan 30, 2012
yebblies
[Issue 3144] (D1 only) Invalid break accepted
Oct 27, 2012
yebblies
Nov 08, 2012
Kenji Hara
July 07, 2009
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: -------
January 30, 2012
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


--- Comment #1 from yebblies <yebblies@gmail.com> 2012-01-30 17:46:39 EST ---
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: -------
January 30, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=3144


yebblies <yebblies@gmail.com> changed:

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


--- Comment #2 from yebblies <yebblies@gmail.com> 2012-01-30 17:53:47 EST ---
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: -------
October 27, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=3144



--- Comment #3 from github-bugzilla@puremagic.com 2012-10-27 04:33:52 PDT ---
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 Merge pull request #1182 from 9rnsr/fix3144

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: -------
October 27, 2012
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


--- Comment #4 from yebblies <yebblies@gmail.com> 2012-10-28 02:27:51 EST ---
Fixed D2

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 08, 2012
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


--- Comment #5 from Kenji Hara <k.hara.pg@gmail.com> 2012-11-08 09:28:23 PST ---
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: -------