Bug 501 – Bad interaction between 'with' and IFTI in template methods

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2006-11-13T13:06:00Z
Last change time
2014-02-15T13:20:53Z
Assigned to
bugzilla
Creator
wbaxter

Comments

Comment #0 by wbaxter — 2006-11-13T13:06:51Z
You can't call a templatized method using IFTI inside a 'with' block. The following code demonstrates. ------------------ import std.stdio : writefln; class Penfold { char[] toString() { return "Krike!"; } } class Pinky { char[] toString() { return "Narf!"; } } class Printer { void vprint(Object obj) { writefln(obj.toString); } C print(C)(C obj) { writefln(obj); return obj; } } void main() { Printer p = new Printer; p.print(new Pinky); p.print(new Penfold); with (p) { // ok vprint(new Pinky); vprint(new Penfold); // Ok print!(Pinky)(new Pinky); print!(Penfold)(new Penfold); // ok p.print(new Pinky); p.print(new Penfold); // error: "type Printer is not an expression" (??) print(new Pinky); print(new Penfold); } }
Comment #1 by wbaxter — 2006-12-03T00:00:47Z
Works for me now in DMD 0.176