[Issue 1615] New: inout is allowed in foreach of string literal

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Oct 27 09:10:31 PDT 2007


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 at digitalmars.com
        ReportedBy: ary at 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.


-- 



More information about the Digitalmars-d-bugs mailing list