www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4101] New: DMD doesn't give error when goto skips initialization

reply d-bugmail puremagic.com writes:
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



---
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: -------
Apr 17 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4101


Don <clugdbug yahoo.com.au> changed:

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



Is this the same as bug 602?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 17 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4101




---

 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: -------
Apr 19 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Dec 18 2011
prev sibling parent d-bugmail puremagic.com writes:
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



*** 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: -------
Oct 31 2013