www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3005] New: ill-defined for statement

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3005

           Summary: ill-defined for statement
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P5
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: andrei metalanguage.com


This compiles and runs:

void main() {
    int x = 2;
    for (while (false) x = 2; x != 2; ) {}
}

along with some other similarly odd constructs.

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


BCS <shro8822 vandals.uidaho.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |shro8822 vandals.uidaho.edu





---
That's been known for some time. It's done that way to allow this to work:

for(int a = 5; a < 10; a++) {}
----[statment]

I think the best "fix" would be to switch from a statement, to allowing an
expression or declaration.

OTOH I'm fine with it as it is as it doesn't cause any known problems with
"reasonable" code.

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


Stewart Gordon <smjg iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|accepts-invalid             |spec






 That's been known for some time. It's done that way to allow this to work:
 
 for(int a = 5; a < 10; a++) {}
 ----[statment]
 
 I think the best "fix" would be to switch from a statement, to allowing an
 expression or declaration.
That's how I thought it was defined - but it turns out ForStatement: for ( Initialize Test ; Increment ) ScopeStatement Initialize: ; NoScopeNonEmptyStatement so I was wrong about this being accepts-invalid. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 19 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3005


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |INVALID



12:20:43 PST ---
I'll mark it as invalid, then.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 19 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3005




12:39:17 PST ---
Cool, this is going to make for some interesting plays :o).

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