[Issue 2544] implicit const casting rules allow violations of const-safety

2009-01-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2544


s...@iname.com changed:

   What|Removed |Added

 CC||s...@iname.com




--- Comment #2 from s...@iname.com  2009-01-02 06:56 ---
I've thought quite a bit about this and come up with what seems to be a
solution, which also deals with another problem that's been around for years. 
I've posted it on the newsgroup, as it's rather long for here.

Possible D2 solution to the upcasting array problem, and a related problem
with const and nested arrays
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.Darticle_id=81566


-- 



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

2009-01-02 Thread d-bugmail
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: bugzi...@digitalmars.com
ReportedBy: dran...@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


--