Bug 8186 – Formatting class object has an alias this to int* field is broken.
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-06-02T02:59:00Z
Last change time
2012-06-02T06:39:57Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0 by k.hara.pg — 2012-06-02T02:59:18Z
From github:
https://github.com/D-Programming-Language/phobos/pull/575#issuecomment-6075942
import std.stdio;
class B
{
int*a;
this(){ a = new int; }
alias a this;
}
void main(){ writeln(B.init); }
dmd/phobos/std/format.d(2577): Error: template std.format.formatValue matches more than one template declaration, dmd/phobos/std/format.d(2151):formatValue(Writer,T,Char) if (is(T == class) && !is(T == enum)) and dmd/phobos/std/format.d(2476):formatValue(Writer,T,Char) if (isPointer!(T))