[Issue 10506] New: Purity should not be checked in a mixin statement

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jun 29 12:59:24 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10506

           Summary: Purity should not be checked in a mixin statement
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-06-29 12:59:23 PDT ---
-----
import std.string;

void test() pure
{
     mixin(["foo", "bar"].join());
}

void main() {}
-----

> test.d(5): Error: pure function 'test.test' cannot call impure function 'std.array.join!(string[]).join'
> test.d(5): Error: found 'EOF' when expecting ';' following statement
> test.d(5): Error: undefined identifier foobar

I think the above should be allowed. I can't think of a case where the code
which *produces* the string to be mixed in can somehow affect the purity of the
function the mixin statement is in.

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


More information about the Digitalmars-d-bugs mailing list