[Issue 2845] New: Alias-to-local as template argument + delegate = Access Violation

2009-04-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2845

   Summary: Alias-to-local as template argument + delegate = Access
Violation
   Product: D
   Version: 2.027
  Platform: PC
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: bugzi...@digitalmars.com
ReportedBy: kin...@is.s.u-tokyo.ac.jp


Here is the minimal code I can reproduce the problem on DMD 2.028 on Windows
Vista:

struct dep_t(alias a)
{
int  memvar;
void memfun() {}
}

dep_t!(a) dep(alias a)()
{
return dep_t!(a)();
}

void dep_and_del(D)(D a, void delegate() b) { /*nothing*/ }

void main()
{
int x = 0;
dep_and_del( dep!(x), {} );
dep_and_del( dep!(x), {x=1;} ); // object.Error: Access Violation
}


-- 



[Issue 2838] std.file.rmdirRecurse fails

2009-04-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2838





--- Comment #5 from graham.stj...@internode.on.net  2009-04-16 22:05 ---
Created an attachment (id=325)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=325&action=view)
Proposed patch for std.file to handle case of linux filesystems that don't set
d_type

Submitted a proposed patch to set DirEntry.d_type in the linux version when the
filesystem doesn't provide d_type is direntry, such as reiserfs.


-- 



[Issue 2838] std.file.rmdirRecurse fails

2009-04-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2838





--- Comment #4 from unkn...@simplemachines.org  2009-04-16 21:03 ---
Ah, yes, that makes sense.

Please feel free to attach a patch.  I'm not the one who'd accept it, but I
think your approach looks sound.  But, beware of convention - curlies, call
syntax, etc. - it's best to stay common within a file.

-[Unknown]


-- 



[Issue 2838] std.file.rmdirRecurse fails

2009-04-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2838





--- Comment #3 from graham.stj...@internode.on.net  2009-04-16 20:05 ---
I have looked into it some more, and it looks like setting of d_type is only
supported on some filesystems. I am using reiserfs, which I guess is a bit
unusual, and it could be that.

Yes, I just tried it with a vfat filesystem on a flash-stick, and d_type was
populated ok.

Can I suggest that, since the posix standard makes population of d_type (and
others) optional, we do something to handle the case where it is set to 0
(DT_UNKNOWN)?

Maybe the easiest thing to do is to modify std.file.DirEntry.init to be
something like:

   void init(string path, dirent *fd)
   {
   immutable len = std.c.string.strlen(fd.d_name.ptr);
   name = std.path.join(path, fd.d_name[0 .. len].idup);
   d_type = fd.d_type;
   didstat = false;

   if (d_type == DT_UNKNOWN) {
   ensureStatDone;
   }
   }

or maybe defer it until isdir or isdile are called.

ensureStatDone would need to be modified to be something like:

   void ensureStatDone()
   {
   if (didstat) return;
   enforce(core.sys.posix.sys.stat.stat(toStringz(name), &statbuf) == 0,
   "Failed to stat file `"~name~"'");
   _size = cast(ulong)statbuf.st_size;
   _creationTime = cast(d_time)statbuf.st_ctime * std.date.TicksPerSecond;
   _lastAccessTime = cast(d_time)statbuf.st_atime *
std.date.TicksPerSecond;
   _lastWriteTime = cast(d_time)statbuf.st_mtime * std.date.TicksPerSecond;

   if (d_type == DT_UNKNOWN) {
   if (S_ISDIR(statbuf.st_mode)) {
   d_type = DT_DIR;
   }
   else if (S_ISREG(statbuf.st_mode)) {
   d_type = DT_REG;
   }
   }

   didstat = true;
   }

And of course std.file needs to be changed to use readdir_r too. If this
approach is acceptable to you, I could have a go at submitting a patch if you
like... 


-- 



[Issue 2835] std.socket.TcpSocket.connect doesn't actually connect

2009-04-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2835





--- Comment #4 from graham.stj...@internode.on.net  2009-04-16 20:00 ---
It did indeed fix the issue. My (improved) test code now works in 2.026 and
2.028 when I use the workaround.


-- 



[Issue 2844] New: Result of getMembers cannot be used because of const

2009-04-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2844

   Summary: Result of getMembers cannot be used because of const
   Product: D
   Version: 2.027
  Platform: PC
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: bugzi...@digitalmars.com
ReportedBy: daniel.keep+d.puremagic@gmail.com


(Note: report is for DMD 2.028.)

The getMembers and xgetMembers functions in ClassInfo and TypeInfo_Struct are
more or less useless because they return const(MemberInfo[]).  None of the
methods of MemberInfo are const, and so cannot be called unless you explicitly
cast away const-ness.


-- 



[Issue 2843] New: ICE with is-expression with invalid dot-expression in is-expression involving typeid expression

2009-04-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2843

   Summary: ICE with is-expression with invalid dot-expression in
is-expression involving typeid expression
   Product: D
   Version: 2.027
  Platform: PC
OS/Version: Linux
Status: NEW
  Keywords: ice-on-invalid-code
  Severity: normal
  Priority: P3
 Component: DMD
AssignedTo: bugzi...@digitalmars.com
ReportedBy: dhase...@gmail.com


foo.bar is typeid(int);

Error message:
bug.d(3): Error: undefined identifier foo
bug.d(3): Error: no property 'bar' for type 'int'
bug.d(3): Error: incompatible types for ((1) is (&_D10TypeInfo_i6__initZ)):
'int' and 'object.TypeInfo'
bug.d(3): Error: is has no effect in expression (1 is &_D10TypeInfo_i6__initZ)
dmd: constfold.c:863: Expression* Identity(TOK, Type*, Expression*,
Expression*): Assertion `0' failed.
Aborted

Thankfully, it gives you the full error message first.


-- 



[Issue 2841] char[] template value arguments broken in D2

2009-04-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2841


clugd...@yahoo.com.au changed:

   What|Removed |Added

   Severity|regression  |major
   Keywords|rejects-valid   |spec




--- Comment #2 from clugd...@yahoo.com.au  2009-04-16 10:48 ---
(In reply to comment #1)
> Um,
> 
> string literals are invariant(char)[].

Indeed.

> The error message sure sucks, but it's not surprising that this doesn't work.

But there is no way that a mutable char [] could be passed as a template value
parameter. And it's not a type. So what is
template(char[] X) ?

int foo(char[] c)() { return 0; }

void main(){
   char [] z;
   int a = foo!(z)(); // ok
}

I can't see anything in the spec to indicate what this means. From the
.mangleof, it seems to be accepting it as an alias parameter.

OK, I'll change this to a spec error.


-- 



[Issue 2842] New: std.file.listdir on OSX produces invalid UTF-8 sequence

2009-04-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2842

   Summary: std.file.listdir on OSX produces invalid UTF-8 sequence
   Product: D
   Version: 1.043
  Platform: PC
OS/Version: Mac OS X
Status: NEW
  Severity: minor
  Priority: P2
 Component: Phobos
AssignedTo: bugzi...@digitalmars.com
ReportedBy: a...@liquidstate.eu


std.file.listdir throws an "invalid UTF-8 sequence" exception.
please see the source file and the produced output below.

thanks.

--
import std.stdio, std.file;

int main(char[][] args)
{
foreach (file; listdir("."))
writefln("%s", file);   
return 0;
}
--
blah:misc user$ dmd listdir.d
blah:misc user$ ./listdir
..

some_directory
Error: 1invalid UTF-8 sequence
blah:misc user$


-- 



[Issue 2841] char[] template value arguments broken in D2

2009-04-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2841





--- Comment #1 from jarrett.billings...@gmail.com  2009-04-16 10:05 ---
Um,

string literals are invariant(char)[].

The error message sure sucks, but it's not surprising that this doesn't work.


-- 



[Issue 2841] New: char[] template value arguments broken in D2

2009-04-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2841

   Summary: char[] template value arguments broken in D2
   Product: D
   Version: 2.027
  Platform: PC
OS/Version: Windows
Status: NEW
  Keywords: rejects-valid
  Severity: regression
  Priority: P2
 Component: DMD
AssignedTo: bugzi...@digitalmars.com
ReportedBy: clugd...@yahoo.com.au


int foo(char[] c)() { return 0; }

void main(){
int a = foo!("abc")();
}
---
fog.d(6): Error: template fog.foo(char[] c) does not match any function
template
 declaration
fog.d(6): Error: template fog.foo(char[] c) cannot deduce template function
from
 argument types !("abc")()
fog.d(6): Error: template instance errors instantiating template

This all works in D1.042. Fails in D2.028.
The code below is similar. Also for class and union.
--
struct C(char[] c){ }

void main(){
   C!("abc") a;
}


-- 



[Issue 934] Segfault taking mangleof a forward reference in a template.

2009-04-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=934


clugd...@yahoo.com.au changed:

   What|Removed |Added

Summary|forward reference by|Segfault taking mangleof a
   |pragma(msg) in template:|forward reference in a
   |"mtype.c:550: virtual   |template.
   |Expression* |
   |Type::getProperty(Loc,  |
   |Identifier*): Assertion |
   |`deco' failed"  |




--- Comment #2 from clugd...@yahoo.com.au  2009-04-16 04:05 ---
Actually it's nothing to do with pragma(msg). It's the mangleof which is the
problem. Change it to .stringof and problem disappears.

template Templ(T) {
const char [] XXX = Type.mangleof;
alias T Type;
}

void main() {
Templ!(int).Type x;  // instantiate
}

Segfaults on DMD2.028.
assert mtype.c(1272) deco


DMD1.042
Assertion failure: 'deco' on line 576 in file 'mtype.c'

abnormal program termination


-- 



[Issue 2840] New: Missing line number for int %= complex

2009-04-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2840

   Summary: Missing line number for int %= complex
   Product: D
   Version: 1.042
  Platform: PC
OS/Version: Windows
Status: NEW
  Keywords: diagnostic
  Severity: minor
  Priority: P2
 Component: DMD
AssignedTo: bugzi...@digitalmars.com
ReportedBy: clugd...@yahoo.com.au


void main(){
   int x;
   x %= 2+2i;
}
fog.d(3): Error: cannot perform modulo complex arithmetic
Error: long has no effect in expression (0)

---
I don't know where the 'long' comes from.
Both D1 and D2. This is one of the many op= bugs for erroneous complex
operations, along with issue #718 and issue #2839.


-- 



[Issue 2839] New: ICE with int /= imaginary

2009-04-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2839

   Summary: ICE with int /= imaginary
   Product: D
   Version: 1.042
  Platform: PC
OS/Version: Windows
Status: NEW
  Keywords: ice-on-invalid-code
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: bugzi...@digitalmars.com
ReportedBy: clugd...@yahoo.com.au


Probably related to Issue #718.

void main(){
   int x;
   x/= 2i;
}

Internal error: ..\ztc\cgcs.c 221
DMD2.028 compiled in debug mode:
el:00C2C4CC cnt=0 cs=0 =  TYdouble 00C2C45C 00C2C494
 el:00C2C45C cnt=0 cs=0 s32_d  TYdouble 00C2C424
  el:00C2C424 cnt=0 cs=0 var  TYint  x
 el:00C2C494 cnt=0 cs=0 const  TYdouble 0
Internal error: backend\cgcs.c 221


-- 



[Issue 718] ICE with int /= cast(creal)

2009-04-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=718


clugd...@yahoo.com.au changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |
Summary|Internal error: |ICE with   int /=
   |../ztc/cgcod.c 562  |cast(creal)
Version|0.177   |2.000




--- Comment #3 from clugd...@yahoo.com.au  2009-04-16 03:35 ---
The bug_cgcod_562_x1 cases have been fixed, but the bug_cgcod_562_x3 cases
remain. This bug accounts for 20% of the remaining Dstress cases which ICE.
Much simpler test case:

void main(){
   int x;
   x/= cast(creal)1;
}

Internal error: ..\ztc\cgcod.c 564

Applies to DMD2.028 as well.


--