www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13120] New: Body of `foreach` over string with transcoding

https://issues.dlang.org/show_bug.cgi?id=13120

          Issue ID: 13120
           Summary: Body of `foreach` over string with transcoding ignores
                    function attributes
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: verylonglogin.reg gmail.com

This code should NOT compile:
---
void f() { }

void g(char[] s) pure  nogc
{
    foreach(dchar dc; s)
        f();
}
---

The behaviour above is correct for ` safe` attribute, but this attribute fails
in case of a template.

This code should NOT compile:
---
void f() { }

void g()(char[] s)
{
    foreach(dchar dc; s)
        f();
}

void h()  safe pure  nogc
{
    g(null);
}
---

--
Jul 13 2014