[Issue 2551] New: std.format on invariant values : error and segmentation fault

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 2 11:42:56 PST 2009


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

           Summary: std.format on invariant values : error and segmentation
                    fault
           Product: D
           Version: 2.022
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: dransic at free.fr


import std.stdio;

class Foo {
    double x;
    this(double x) { this.x = x; }
}

void main() {
    auto ifoo = new invariant(Foo)(0.);
    auto foo = new Foo(0.);
    writeln(foo.x);
    writeln(ifoo.x); // <- Error
}

causes this compiler output :

/usr/local/bin/../src/phobos/std/format.d(2048): Error: no property 'toString'
for type 'invariant(double)'
/usr/local/bin/../src/phobos/std/format.d(2049): template
std.stdio.PrivateFileWriter!(char).PrivateFileWriter.write(C) does not match
any function template declaration
/usr/local/bin/../src/phobos/std/format.d(2049): template
std.stdio.PrivateFileWriter!(char).PrivateFileWriter.write(C) cannot deduce
template function from argument types !()(int)
Segmentation fault


-- 



More information about the Digitalmars-d-bugs mailing list