[Issue 4857] New: Missing shared overloads in object

2010-09-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4857

   Summary: Missing shared overloads in object
   Product: D
   Version: D2
  Platform: Other
OS/Version: Mac OS X
Status: NEW
  Severity: major
  Priority: P2
 Component: druntime
AssignedTo: s...@invisibleduck.org
ReportedBy: d...@me.com


--- Comment #0 from Jacob Carlborg d...@me.com 2010-09-13 00:58:41 PDT ---
The object module should overload appropriate functions and methods with the
shared qualifier. For example, the following doesn't not compile:

class Foo
{
 private Object value;

 synchronized bool hasValue (Object val)
 {
 return value == val;
 }
}

Because opEquals in object doesn't accept shared parameters.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3665] Regression(1.051, 2.036) Assignment with array slicing does not work

2010-09-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3665


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

   What|Removed |Added

   Keywords||patch


--- Comment #2 from Don clugd...@yahoo.com.au 2010-09-13 01:00:54 PDT ---
This is very simple: in arrayop.c, the assignment operators have been left out
of the lists of valid operations.

PATCH:

bool isArrayOpValid(Expression *e), line 54.

case TOKand:
case TOKor:
case TOKpow:
case TOKand:
case TOKor:
case TOKpow:
+case TOKassign:
+case TOKaddass:
+case TOKminass:
+case TOKmulass:
+case TOKdivass:
+case TOKmodass:
+case TOKxorass:
+case TOKandass:
+case TOKorass:
+case TOKpowass:
 return isArrayOpValid(((BinExp *)e)-e1) 
isArrayOpValid(((BinExp *)e)-e2);

And again in isArrayOperand(), line 600

case TOKand:
case TOKor:
+case TOKpow:
+case TOKassign:
+case TOKaddass:
+case TOKminass:
+case TOKmulass:
+case TOKdivass:
+case TOKmodass:
+case TOKxorass:
+case TOKandass:
+case TOKorass:
+case TOKpowass:
case TOKneg:
case TOKtilde:
return 1;

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4858] New: Cannot call synchronized method through super

2010-09-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4858

   Summary: Cannot call synchronized method through super
   Product: D
   Version: D2
  Platform: Other
OS/Version: Mac OS X
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: d...@me.com


--- Comment #0 from Jacob Carlborg d...@me.com 2010-09-13 01:05:04 PDT ---
Compiling this piece of code:

class Base
{
 synchronized void func (string s) { }
}

class Foo : Base
{
 synchronized void bar (string key) { super.func(key); }
}

Gives this error:

main.d(13): Error: function main.Base.func (string s) shared is not callable
using argument types (string)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4859] New: Another File.byChunk()

2010-09-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4859

   Summary: Another File.byChunk()
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2010-09-13 04:18:49 PDT ---
std.stdio.File.byChunk reuses the content of buffer across calls, but I think
the first call performs an allocation. Tango has shown that an important factor
for the performance of D programs is to minimize memory allocations.

So an overloaded byChunk may be added with a signature similar to (so the older
byChunk() is not removed, this is added):
chunks byChunk(void[] buffer);


So you may use it like this and avoid the first memory allocation too:

ubyte[4096] buffer;
foreach (ubyte[] chunk; stdin.byChunk(buffer[])) {
... use chunk ...
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4860] New: Taking delegates to a member function broken if method is also aliased in from a base class

2010-09-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4860

   Summary: Taking delegates to a member function broken if method
is also aliased in from a base class
   Product: D
   Version: D2
  Platform: x86_64
OS/Version: Mac OS X
Status: NEW
  Severity: critical
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: c...@klickverbot.at


--- Comment #0 from klickverbot c...@klickverbot.at 2010-09-13 07:53:08 PDT 
---
Consider the following example (the alias directive in there might seem
strange, but is needed if there would be another, non-overridden overload of
foo (see http://www.digitalmars.com/d/2.0/function.html#function-inheritance):

---
import std.stdio;

class Base {
  void foo() {
  }
}

class Derived : Base {
  alias Base.foo foo;
  override void foo() {
  }
}

void main() {
  auto d = new Derived();
  void delegate() dg = d.foo;
  writefln(dg: (%s, %s), dg.ptr, dg.funcptr);
}
---

As long as the alias is present, the delegate created via »d.foo« is invalid –
its funcptr part is null (and indeed, trying to call the delegate yields an
access violation). If the alias directive is removed, everything works as
expected, but as explained above, this is not an option.

What may be also relevant is that DMD fails to infer the type for »d.foo« –
replacing »void delegate() dg« with »auto dg« produces »cannot infer type from
overloaded function symbol d.foo«.

I would also be happy to learn about any workarounds, since this blocks the
release of my D SWIG module.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4861] New: Zip-sorting broken

2010-09-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4861

   Summary: Zip-sorting broken
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: regression
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: dsim...@yahoo.com


--- Comment #0 from David Simcha dsim...@yahoo.com 2010-09-13 10:05:33 PDT ---
Latest SVN release of Phobos (1993), DMD 2.048, must be run w/ asserts enabled:

import std.algorithm, std.range;

void main() {
auto a = [5,4,3,2,1];
auto b = [3,1,2,5,6];
auto z = zip(a, b);

sort!a.field[0]  b.field[0](z);
}

core.exception.asserter...@d:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(5187):
Zip!(int[],int[]): [Tuple!(int,int)(4, 1) Tuple!(int,int)(5, 3)
Tuple!(int,int)(3, 2) Tuple!(int,int)(1, 6) Tuple!(int,int)(2, 5)]

For some reason the zip-sorting case used in the Zip unittest seems to miss
this bug, but it occurs on almost all real-world inputs.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4860] Taking delegates to a member function broken if method is also aliased in from a base class

2010-09-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4860



--- Comment #1 from klickverbot c...@klickverbot.at 2010-09-13 14:23:03 PDT 
---
Iain pointed out on #d that the example above works if you put the alias
directive *after* the last overload:

---
import std.stdio;

class Base {
  void foo() {
  }
}

class Derived : Base {
  override void foo() {
  }
  alias Base.foo foo;
}

void main() {
  auto d = new Derived();
  void delegate() dg = d.foo;
  writefln(dg: (%s, %s), dg.ptr, dg.funcptr);
}
---

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4860] Taking delegates to a member function broken if method is also aliased in from a base class

2010-09-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4860


Steven Schveighoffer schvei...@yahoo.com changed:

   What|Removed |Added

 CC||schvei...@yahoo.com


--- Comment #2 from Steven Schveighoffer schvei...@yahoo.com 2010-09-13 
14:31:07 PDT ---
In order to make this bug report valid, you should cite a better example.  In
your example, you are overriding the base function, and then also aliasing it. 
Yes, in the case you reference, it's valid, but your trivial example is
nonsensical -- you get nothing by aliasing Base.foo in this case.

I am pretty sure you have a better example :)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4860] Taking delegates to a member function broken if method is also aliased in from a base class

2010-09-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4860



--- Comment #3 from klickverbot c...@klickverbot.at 2010-09-13 14:37:15 PDT 
---
Steven, I am not quite sure if I see why a non-minimal code snippet in a bug
report would be useful, but here you go:

---
import std.stdio;

class Base {
  void foo( int i ) {}
  void foo( string s ) {}
}

class Derived : Base {
  alias Base.foo foo;
  override void foo( int i ) {}
}

void main() {
  auto d = new Derived();
  void delegate( int ) dg = d.foo;
  writefln(dg: (%s, %s), dg.ptr, dg.funcptr);
}
---

Feel free to reduce that to the above test case again. ;)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4860] Taking delegates to a member function broken if method is also aliased in from a base class

2010-09-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4860



--- Comment #4 from Steven Schveighoffer schvei...@yahoo.com 2010-09-13 
14:46:31 PDT ---
(In reply to comment #3)
 Steven, I am not quite sure if I see why a non-minimal code snippet in a bug
 report would be useful

Because it avoids an argument against fixing the bug because the use case is
completely useless.  Your new example is perfect, thanks!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4862] New: modfl() missing for FreeBSD

2010-09-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4862

   Summary: modfl() missing for FreeBSD
   Product: D
   Version: D2
  Platform: x86
OS/Version: FreeBSD
Status: NEW
  Severity: normal
  Priority: P2
 Component: druntime
AssignedTo: s...@invisibleduck.org
ReportedBy: bugs-purema...@jelal.kn-bremen.de


--- Comment #0 from Juergen Lock bugs-purema...@jelal.kn-bremen.de 2010-09-13 
15:11:36 PDT ---
Created an attachment (id=755)
add back modfl() for FreeBSD

adding it back as in the attached patch _seems_ to work according to quick
tests (was the problem that real * i.e. long double * wasn't working properly
for C bindings in earlier versions and the FreeBSD bindings just hadn't been
updated yet?)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4863] New: DWARF debug symbols treat arrays as unsigned long long

2010-09-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4863

   Summary: DWARF debug symbols treat arrays as unsigned long long
   Product: D
   Version: D2
  Platform: x86
OS/Version: FreeBSD
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bugs-purema...@jelal.kn-bremen.de


--- Comment #0 from Juergen Lock bugs-purema...@jelal.kn-bremen.de 2010-09-13 
15:34:38 PDT ---
(I haven't checked if this also affects D1, and it probably also affects
non-FreeBSD *ixes at least.)

I tested both gdb head (checked out after the D patches went in) and Doug
Rabson's D-aware debugger ngdb which he annouced as a 'Technology Preview'
here:

http://lists.freebsd.org/pipermail/freebsd-current/2009-August/011071.html

..and found two things:

a) gdb still chokes on dmd -g debug symbols because the
   D DWARF extensions conflict with DWARF-4:

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

   disabling the DW_TAG_type_unit case in gdb/dwarf2read.c
   at least makes it no longer complain:

http://people.freebsd.org/~nox/tmp/d/d-gdb-dwarf2read.c.patch

b) both debuggers treat arrays as unsigned long long (like main()'s standard
string[] args) - at least ngdb prints them correctly if I do a manual cast:

(ngdb) p *cast(char [][] *)args

   I then looked at the debug symbols using readelf -w and found it's actually
dmd's fault not the debugger's, the array really seems to be marked as the
unsigned long long type:

1a4: Abbrev Number: 3 (DW_TAG_base_type)
 DW_AT_name: unsigned long long
 DW_AT_byte_size   : 8
 DW_AT_encoding: 7  (unsigned)
..
2516: Abbrev Number: 5 (DW_TAG_formal_parameter)
 DW_AT_name: args
 DW_AT_type: a4
 DW_AT_location: 2 byte block: 91 8 (DW_OP_fbreg: 8)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4860] Taking delegates to a member function broken if method is also aliased in from a base class

2010-09-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4860


nfx...@gmail.com changed:

   What|Removed |Added

 CC||nfx...@gmail.com


--- Comment #5 from nfx...@gmail.com 2010-09-13 19:07:55 PDT ---
What? A bug is a bug, it doesn't matter if the code causing it is nonsensical.
A code snippet reproducing a bug should be as minimal as possible.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4863] DWARF debug symbols treat arrays as unsigned long long

2010-09-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4863


nfx...@gmail.com changed:

   What|Removed |Added

 CC||nfx...@gmail.com


--- Comment #1 from nfx...@gmail.com 2010-09-13 19:10:50 PDT ---
I think dmd uses ulong for arrays internally. All the array runtime functions
in lifetime.d (Tango/druntime) actually return array descriptors as ulong!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 535] writef doesn't work on interfaces

2010-09-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=535


Andrei Alexandrescu and...@metalanguage.com changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


--- Comment #4 from Andrei Alexandrescu and...@metalanguage.com 2010-09-13 
19:44:38 PDT ---
http://www.dsource.org/projects/phobos/changeset/1996

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 626] std.format.doFormat accepts non-string arrays with any format specifier

2010-09-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=626


Andrei Alexandrescu and...@metalanguage.com changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


--- Comment #1 from Andrei Alexandrescu and...@metalanguage.com 2010-09-13 
20:26:11 PDT ---
writefln(%d, [1,2,3]) works as designed - arrays pass down the format spec to
each of their elements. http://www.dsource.org/projects/phobos/changeset/1998
takes care of the rest.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 755] std.utf.decode() throws exception with unclear error message

2010-09-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=755


Andrei Alexandrescu and...@metalanguage.com changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


--- Comment #3 from Andrei Alexandrescu and...@metalanguage.com 2010-09-13 
20:32:44 PDT ---
I replaced the culprit with:

throw new UtfException(text(dchar decode(in char[], ref size_t): 
Invalid UTF-8 sequence , cast(const ubyte[]) s,
 around index , i));

http://www.dsource.org/projects/phobos/changeset/1999

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---