[Issue 13120] New: Body of `foreach` over string with transcoding ignores function attributes

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Jul 13 01:45:36 PDT 2014


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 at puremagic.com
          Reporter: verylonglogin.reg at 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);
}
---

--


More information about the Digitalmars-d-bugs mailing list