[Issue 8547] New: Pure Functions Compilation - Not consistent errors

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 15 04:50:55 PDT 2012


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

           Summary: Pure Functions Compilation - Not consistent errors
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: daniel350 at bigpond.com


--- Comment #0 from Daniel Cousens <daniel350 at bigpond.com> 2012-08-15 04:50:45 PDT ---
module vector;

struct vec2(T) {
      T x, y;

      this(T x, T y) { this.x = x; this.y = y; }
      auto opDispatch(string swiz)() pure const {
            writeln(swiz);
            return 2;
      }
}

alias vec2!int vec2i;

import std.stdio;

void main() {
//    auto x = new vec2i(1, 2); // error about writeln (inpure function) in
pure function
      auto x = vec2i(1, 2); // no error, just fails to compile

      writeln(x.xy);
}

-- 
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