www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1615] New: inout is allowed in foreach of string literal

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

           Summary: inout is allowed in foreach of string literal
           Product: D
           Version: 1.022
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: ary esperanto.org.ar


The following code compiles:

---
void main() {
        foreach(inout char x; "hola") {
                x = '?';
        }
}
---

But I think an error should be pointed, because x cannot be inout since the
source aggregate is a string literal, which is immutable.


-- 
Oct 27 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1615


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com
           Keywords|                            |accepts-invalid





This is closely related to issue 1322 - the difference is that this applies to
D 1.x as well.


-- 
Nov 08 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1615


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED





Fixed dmd 2.019


-- 
Sep 02 2008