Switch case falltrhough, regression or intended behavior ?

2013-02-17 Thread deadalnix
I have several instance of cases like this : switch(c) { case 'U', 'u' : case 'L', 'l' : // code . . . } dmd from master complains about it (Error: switch case fallthrough - use 'goto case;' if intended). It used to work. Note that in that case, the fix is triv

Re: Switch case falltrhough, regression or intended behavior ?

2013-02-17 Thread Andrei Alexandrescu
On 2/17/13 11:10 AM, deadalnix wrote: I have several instance of cases like this : switch(c) { case 'U', 'u' : case 'L', 'l' : // code . . . } dmd from master complains about it (Error: switch case fallthrough - use 'goto case;' if intended). It used to work. Note that in that case, the fix is

Re: Switch case falltrhough, regression or intended behavior ?

2013-02-17 Thread Steven Schveighoffer
On Sun, 17 Feb 2013 11:10:58 -0500, deadalnix wrote: I have several instance of cases like this : switch(c) { case 'U', 'u' : case 'L', 'l' : // code . . . } dmd from master complains about it (Error: switch case fallthrough - use 'goto case;' if intended). I

Re: Switch case falltrhough, regression or intended behavior ?

2013-02-17 Thread David Nadlinger
On Sunday, 17 February 2013 at 16:10:59 UTC, deadalnix wrote: dmd from master complains about it (Error: switch case fallthrough - use 'goto case;' if intended). It used to work. Does it happen on the staging branch as well? David

Re: Switch case falltrhough, regression or intended behavior ?

2013-02-17 Thread Stewart Gordon
On 17/02/2013 16:10, deadalnix wrote: I have several instance of cases like this : switch(c) { case 'U', 'u' : case 'L', 'l' : // code . . . } dmd from master complains about it (Error: switch case fallthrough - use 'goto case;' if intended). It used to work. Implicit fal

Re: Switch case falltrhough, regression or intended behavior ?

2013-02-17 Thread deadalnix
On Sunday, 17 February 2013 at 17:16:44 UTC, David Nadlinger wrote: On Sunday, 17 February 2013 at 16:10:59 UTC, deadalnix wrote: dmd from master complains about it (Error: switch case fallthrough - use 'goto case;' if intended). It used to work. Does it happen on the staging branch as well?

Re: Switch case falltrhough, regression or intended behavior ?

2013-02-17 Thread Jonathan M Davis
On Sunday, February 17, 2013 17:26:01 Stewart Gordon wrote: > On 17/02/2013 16:10, deadalnix wrote: > > I have several instance of cases like this : > > > > switch(c) { > > > > case 'U', 'u' : > > > > case 'L', 'l' : > > // code . . . > > > > } > > > > dmd from master c

Re: Switch case falltrhough, regression or intended behavior ?

2013-02-17 Thread Andrej Mitrovic
On 2/17/13, deadalnix wrote: > It used to work. Are you sure it's a regression? 2.062: $ dmd test.d > $ dmd -w test.d > test.d(8): Error: switch case fallthrough - use 'goto case;' if intended > test.d(10): Error: switch case fallthrough - use 'goto default;' if intended I've tested from 2.062

Re: Switch case falltrhough, regression or intended behavior ?

2013-02-17 Thread Nick Sabalausky
On Sun, 17 Feb 2013 22:03:33 +0100 Andrej Mitrovic wrote: > On 2/17/13, deadalnix wrote: > > It used to work. > > Are you sure it's a regression? > > 2.062: > $ dmd test.d > > > > $ dmd -w test.d > > test.d(8): Error: switch case fallthrough - use 'goto case;' if > > intended test.d(10): Erro

Re: Switch case falltrhough, regression or intended behavior ?

2013-02-17 Thread Andrej Mitrovic
On 2/17/13, Nick Sabalausky wrote: > Hmm, that brings up a different (though minor) issue: If it's a > warning, why does it say "Error"? I can see in the source there's a check for the -w flag but then an error is raised by mistake. This should either be an error regardless of -w or be changed in

Re: Switch case falltrhough, regression or intended behavior ?

2013-02-17 Thread Andrej Mitrovic
On 2/17/13, Andrej Mitrovic wrote: > On 2/17/13, Nick Sabalausky wrote: >> Hmm, that brings up a different (though minor) issue: If it's a >> warning, why does it say "Error"? > > I can see in the source there's a check for the -w flag but then an > error is raised by mistake. This should either

Re: Switch case falltrhough, regression or intended behavior ?

2013-02-17 Thread Andrej Mitrovic
On 2/17/13, deadalnix wrote: > I have several instance of cases like this : > > switch(c) { > case 'U', 'u' : > case 'L', 'l' : > // code . . . > } Found the report: http://d.puremagic.com/issues/show_bug.cgi?id=6552

Re: Switch case falltrhough, regression or intended behavior ?

2013-02-17 Thread Jonathan M Davis
On Sunday, February 17, 2013 16:08:13 Nick Sabalausky wrote: > On Sun, 17 Feb 2013 22:03:33 +0100 > > Andrej Mitrovic wrote: > > On 2/17/13, deadalnix wrote: > > > It used to work. > > > > Are you sure it's a regression? > > > > 2.062: > > $ dmd test.d > > > > > > $ dmd -w test.d > > > > >

Re: Switch case falltrhough, regression or intended behavior ?

2013-02-17 Thread Andrej Mitrovic
On 2/17/13, Jonathan M Davis wrote: > Probably because -w turns warnings into errors. That's its whole schtick. Really? Man this is confusing.. > However, -wi also appears to say "Error," which definitely isn't correct. Ok good to know. I'm making a pull for these fixes.

Re: Switch case falltrhough, regression or intended behavior ?

2013-02-17 Thread Stewart Gordon
On 17/02/2013 20:07, Jonathan M Davis wrote: Implicit fall through shouldn't have been allowed from the beginning. It would appear that this has finally been banned. Implicit fallthrough is a warning when a case stament is non-empty, but if it's empty (as in the example), then there is no war

Re: Switch case falltrhough, regression or intended behavior ?

2013-02-17 Thread Andrej Mitrovic
On 2/18/13, Stewart Gordon wrote: > There's no such thing as an "empty case statement", unless you mean the case > where the > ScopeStatementList is ";" or "{}" by itself. Look at the grammar > carefully. > > So by the current spec, the first example is a syntax error, since a > CaseStatement > e

Re: Switch case falltrhough, regression or intended behavior ?

2013-02-17 Thread Stewart Gordon
On 17/02/2013 21:46, Jonathan M Davis wrote: Hmm, that brings up a different (though minor) issue: If it's a warning, why does it say "Error"? Probably because -w turns warnings into errors. That's its whole schtick. No, the whole schtick of -w is that it causes warnings to be emitted at all

Re: Switch case falltrhough, regression or intended behavior ?

2013-02-17 Thread Stewart Gordon
On 18/02/2013 01:10, Andrej Mitrovic wrote: The grammar and spec are often broken. The OP sample is completely valid. The whole point of a spec is to define the language. So if the spec makes some code illegal, then (at least for the time being) it is illegal. Stewart.

Re: Switch case falltrhough, regression or intended behavior ?

2013-02-17 Thread Jonathan M Davis
On Monday, February 18, 2013 01:04:41 Stewart Gordon wrote: > On 17/02/2013 20:07, Jonathan M Davis wrote: > > > >> Implicit fall through shouldn't have been allowed from the beginning. It > >> would appear that this has finally been banned. > > > > Implicit fallthrough is a warning when a case

Re: Switch case falltrhough, regression or intended behavior ?

2013-02-17 Thread Steven Schveighoffer
On Sun, 17 Feb 2013 20:28:51 -0500, Stewart Gordon wrote: On 18/02/2013 01:10, Andrej Mitrovic wrote: The grammar and spec are often broken. The OP sample is completely valid. The whole point of a spec is to define the language. So if the spec makes some code illegal, then (at least f

Re: Switch case falltrhough, regression or intended behavior ?

2013-02-17 Thread Stewart Gordon
On 18/02/2013 01:30, Jonathan M Davis wrote: On Monday, February 18, 2013 01:04:41 Stewart Gordon wrote: On 17/02/2013 20:07, Jonathan M Davis wrote: Implicit fallthrough is a warning when a case stament is non-empty, but if it's empty (as in the example), then there is no warning. What ve

Re: Switch case falltrhough, regression or intended behavior ?

2013-02-18 Thread Nick Sabalausky
On Sun, 17 Feb 2013 22:53:13 +0100 Andrej Mitrovic wrote: > On 2/17/13, Jonathan M Davis wrote: > > Probably because -w turns warnings into errors. That's its whole > > schtick. > > Really? Man this is confusing.. > The -w is just simply the "treat warnings as errors" switch (and of course it

Re: Switch case falltrhough, regression or intended behavior ?

2013-02-24 Thread Stewart Gordon
On 18/02/2013 01:21, Stewart Gordon wrote: On 17/02/2013 21:46, Jonathan M Davis wrote: Probably because -w turns warnings into errors. That's its whole schtick. No, the whole schtick of -w is that it causes warnings to be emitted at all. It's a quirk of the way it was designed that it tre

Re: Switch case falltrhough, regression or intended behavior ?

2013-02-24 Thread Jonathan M Davis
On Monday, February 25, 2013 01:42:10 Stewart Gordon wrote: > On 18/02/2013 01:21, Stewart Gordon wrote: > > On 17/02/2013 21:46, Jonathan M Davis wrote: > > > >> Probably because -w turns warnings into errors. That's its whole schtick. > > > > No, the whole schtick of -w is that it causes warni

Re: Switch case falltrhough, regression or intended behavior ?

2013-02-25 Thread Stewart Gordon
On 25/02/2013 02:01, Jonathan M Davis wrote: There's a more important way in which it isn't quite "treat warnings as errors": if you use an IsExpression to test the validity of a snippet of code, a pass with warnings must still be a pass. Otherwise, you'll get code that compiles with or without