Thread overview
[Issue 4101] New: DMD doesn't give error when goto skips initialization
Apr 17, 2010
Jerry Quinn
Apr 18, 2010
Don
Apr 20, 2010
Jerry Quinn
[Issue 4101] [tdpl] DMD doesn't give error when goto skips initialization
Oct 31, 2013
Martin Nowak
April 17, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4101

           Summary: DMD doesn't give error when goto skips initialization
           Product: D
           Version: 2.041
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: jlquinn@optonline.net


--- Comment #0 from Jerry Quinn <jlquinn@optonline.net> 2010-04-17 13:23:00 PDT ---
The following code should not compile but does with DMD 2.041. The goto skips several initializations.

 void foo() {
    goto L0;
      int b;
      struct S { int a; this(int c) { a=c; } }
      S s = S(5);
      class C { int a; }
      C c = new C;
   L0: ;
      s.a++;
      c.a++;
 }

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 18, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4101


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug@yahoo.com.au


--- Comment #1 from Don <clugdbug@yahoo.com.au> 2010-04-17 23:56:47 PDT ---
Is this the same as bug 602?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 20, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4101



--- Comment #2 from Jerry Quinn <jlquinn@optonline.net> 2010-04-19 17:56:44 PDT ---
(In reply to comment #1)
> Is this the same as bug 602?

It's related.  There's an implicit init being accepted here.  However, there are 2 explicit inits being ignored as well, and bug 602 doesn't report that.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 19, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4101


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei@metalanguage.com
            Summary|DMD doesn't give error when |[tdpl] DMD doesn't give
                   |goto skips initialization   |error when goto skips
                   |                            |initialization


--- Comment #3 from Andrei Alexandrescu <andrei@metalanguage.com> 2011-12-18 18:20:26 PST ---
Another example:

unittest
{
      goto target;
      int x = 10;
      target:
      int y = x;
}

TDPL claims that that can't happen.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 31, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=4101


Martin Nowak <code@dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |code@dawg.eu
         Resolution|                            |DUPLICATE


--- Comment #4 from Martin Nowak <code@dawg.eu> 2013-10-31 10:15:09 PDT ---
*** This issue has been marked as a duplicate of issue 602 ***

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