Bug 8547 – Pure Functions Compilation - Not consistent errors

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-08-15T04:50:00Z
Last change time
2015-06-09T05:15:01Z
Keywords
diagnostic
Assigned to
nobody
Creator
daniel350
See also
http://d.puremagic.com/issues/show_bug.cgi?id=8387

Comments

Comment #0 by daniel350 — 2012-08-15T04:50:45Z
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); }
Comment #1 by daniel350 — 2012-08-15T04:55:41Z
To be clear, an error was expected for both, not just one.
Comment #2 by daniel350 — 2012-09-22T03:24:53Z
*** This issue has been marked as a duplicate of issue 8387 ***