Thread overview |
---|
January 02, 2009 [Issue 2551] New: std.format on invariant values : error and segmentation fault | ||||
---|---|---|---|---|
| ||||
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@digitalmars.com ReportedBy: dransic@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 -- |
March 27, 2009 [Issue 2551] std.format on invariant values : error and segmentation fault | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2551 ------- Comment #1 from dsimcha@yahoo.com 2009-03-27 11:48 ------- The problem is the following code: } else static if (is(const D == const(float)) || is(const(D) == const(double)) || is(const(D) == const(real))) { // Do stuff. } else // Similar stuff for more types. The problem is that const(immutable(T)) seems to evaluate to immutable(T), not const(T), as the following program demonstrates: import std.stdio; void main() { immutable real foo = 1.0L; alias const(typeof(foo)) T; writeln(T.stringof); // Prints immutable(real). } This can probably be fixed by changing is(const(T) == const someType) tests to is(immutable(T) == immutable someType). -- |
March 27, 2009 [Issue 2551] std.format on invariant values : error and segmentation fault | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2551 ------- Comment #2 from dsimcha@yahoo.com 2009-03-27 14:28 ------- Created an attachment (id=294) --> (http://d.puremagic.com/issues/attachment.cgi?id=294&action=view) Patch for std.format problems. Here's a patch that does what I suggested previously. It seems to solve the problem, and all of the std.format unittests still pass, except for the ones on lines 2462 and 2464, which don't pass even without the patch. -- |
October 19, 2009 [Issue 2551] std.format on invariant values : error and segmentation fault | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2551 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |clugdbug@yahoo.com.au Resolution| |FIXED --- Comment #3 from Don <clugdbug@yahoo.com.au> 2009-10-19 01:19:49 PDT --- This was fixed between 2.026 and 2.030. I believe the segfault was fixed in 2.027. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation