www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Compiler should error when goto over initialization?

reply "Jesse Phillips" <jessekphillips+D gmail.com> writes:
I'm thinking I this is supposed to be a compiler error and I 
should report as a bug:

"It is illegal for a GotoStatement to be used to skip 
initializations."

     void main() {
         goto b;
         int num = 5;
     b:
         num = 7;
     }
Sep 16 2012
parent reply "Iain Buclaw" <ibuclaw ubuntu.com> writes:
On Sunday, 16 September 2012 at 18:20:49 UTC, Jesse Phillips 
wrote:
 I'm thinking I this is supposed to be a compiler error and I 
 should report as a bug:

 "It is illegal for a GotoStatement to be used to skip 
 initializations."

     void main() {
         goto b;
         int num = 5;
     b:
         num = 7;
     }
Has not been implemented yet. :-) I'm sure there is already a ticket open for it. Regards Iain
Sep 16 2012
parent "Jesse Phillips" <jessekphillips+D gmail.com> writes:
On Sunday, 16 September 2012 at 18:33:22 UTC, Iain Buclaw wrote:
 On Sunday, 16 September 2012 at 18:20:49 UTC, Jesse Phillips 
 wrote:
 I'm thinking I this is supposed to be a compiler error and I 
 should report as a bug:

 "It is illegal for a GotoStatement to be used to skip 
 initializations."

    void main() {
        goto b;
        int num = 5;
    b:
        num = 7;
    }
Has not been implemented yet. :-) I'm sure there is already a ticket open for it. Regards Iain
Yes, thank you http://d.puremagic.com/issues/show_bug.cgi?id=602 http://d.puremagic.com/issues/show_bug.cgi?id=4101
Sep 17 2012