[Issue 7810] [CTFE] Typesafe variadic function with array of structs

2012-10-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7810



--- Comment #9 from Don clugd...@yahoo.com.au 2012-10-01 06:17:47 PDT ---
Further reduced shows it's a problem with void initialized static arrays. I
have a fix.

int bug7810() {

int[1][3] x = void;
x[0] = [2];
x[1] = [7];
assert(x[0][0] == 2);
return 1;
}
static assert(bug7810());

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


[Issue 8742] New: Anonymous nested class derived from another nested class makes DMD crash

2012-10-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8742

   Summary: Anonymous nested class derived from another nested
class makes DMD crash
   Product: D
   Version: D1  D2
  Platform: x86_64
OS/Version: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: david.ecka...@sociomantic.com


--- Comment #0 from David Eckardt david.ecka...@sociomantic.com 2012-10-01 
06:29:21 PDT ---
When compiling the following example module, DMD 1.075 or 2.060 crashes with
Segmentation Fault with -version=Crash; it does not without.

---
module crash;

class C
{
class D { }
}

void main ( )
{
auto c = new C;

version(Crash) auto d = c.new class C.D { };
} 
---

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


[Issue 7810] [CTFE] Typesafe variadic function with array of structs

2012-10-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7810



--- Comment #10 from Don clugd...@yahoo.com.au 2012-10-01 07:16:00 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1155

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


[Issue 8744] New: pragma(msg) incorrectly prints uint values = 2^31

2012-10-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8744

   Summary: pragma(msg) incorrectly prints uint values = 2^31
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: trivial
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: psztur...@tlen.pl


--- Comment #0 from Piotr Szturmaj psztur...@tlen.pl 2012-10-01 12:45:08 PDT 
---
The statement:

pragma(msg, uint.max);

prints -1u where it should print 4294967295u.

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


[Issue 8744] pragma(msg) incorrectly prints uint values = 2^31

2012-10-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8744



--- Comment #1 from Piotr Szturmaj psztur...@tlen.pl 2012-10-01 12:45:28 PDT 
---
https://github.com/D-Programming-Language/dmd/pull/1156

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


[Issue 8743] Add support for memoizing class methods

2012-10-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8743



--- Comment #1 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-10-01 
13:19:45 PDT ---
Here's another one that has rehashing ability: http://dpaste.dzfl.pl/abb6086f

But it comes with a runtime cost of a boolean check. I'd love to be able to
make rehash a compile-time parameter, but I can't seem to make opCall work with
it. Even if it did work I'd have to figure out a way to store the hash outside
of the template since each template instance has it's own internal hash.

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


[Issue 8743] Add support for memoizing class methods

2012-10-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8743



--- Comment #2 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-10-01 
13:23:08 PDT ---
Ahh, I've got it! Templates have their own scope, so the hash can go outside:

http://dpaste.dzfl.pl/4ba280c7

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


[Issue 8743] Add support for memoizing class methods

2012-10-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8743


bearophile_h...@eml.cc changed:

   What|Removed |Added

 CC||bearophile_h...@eml.cc


--- Comment #3 from bearophile_h...@eml.cc 2012-10-01 14:00:29 PDT ---
(In reply to comment #2)
 Ahh, I've got it! Templates have their own scope, so the hash can go outside:
 
 http://dpaste.dzfl.pl/4ba280c7

I suggest to put a copy of it in Bugzilla (as attach or just pasting it here),
so it's readable even if dpaste is down, or it deletes this paste, etc.

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


[Issue 8743] Add support for memoizing class methods

2012-10-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8743



--- Comment #4 from bearophile_h...@eml.cc 2012-10-01 14:03:50 PDT ---
void rehash() { memo = null; }

Maybe do you mean something like this?

void rehash() { memo.rehash; }
void clear() { memo = null; }

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


[Issue 8745] New: floating point comparison (is vs ==) inconsistency (on 32)

2012-10-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8745

   Summary: floating point comparison (is vs ==) inconsistency
(on 32)
   Product: D
   Version: unspecified
  Platform: x86
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: monarchdo...@gmail.com


--- Comment #0 from monarchdo...@gmail.com 2012-10-01 14:21:50 PDT ---
From http://forum.dlang.org/group/digitalmars.D.learn

//
import std.stdio;
import std.math;

@property double getFloat()
{
   return sqrt(1.1);
}

void main()
{
writeln(getFloat() == getFloat());
writeln(getFloat() is getFloat());
}
//

x32 Produces http://dpaste.dzfl.pl/e0e0bbae :
false
true

x64 Produces http://dpaste.dzfl.pl/c1c7a415 :
true
true

While one may argue that the comparison *may* return false, the difference in
behavior between == and is not expected behavior (unless I'm missing
something...? ).

PS: the behavior difference is consistent http://dpaste.dzfl.pl/2ee9ae4e :
//
import std.stdio;
import std.math;

@property double getFloat()
{
   return sqrt(1.1);
}

void main()
{
writeln(getFloat() == getFloat());
writeln(getFloat() is getFloat());
writeln(getFloat() is getFloat());
writeln(getFloat() == getFloat());
writeln(getFloat() is getFloat());
writeln(getFloat() == getFloat());
writeln(getFloat() == getFloat());
writeln(getFloat() is getFloat());
}
//
false
true
true
false
true
false
false
true
//

On a side note, I find it strange that == return false in such a consistent
manner. It might be over-sensitive to extended precision?

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


[Issue 4571] Non-null class references/pointers

2012-10-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4571



--- Comment #6 from bearophile_h...@eml.cc 2012-10-01 14:26:20 PDT ---
A small program that shows three important things std.typecons.Nullable isn't
able to do:


import std.stdio, std.algorithm, std.typecons;

alias Nullable!(int, -1) Position;

void foo(int[] a, Position pos) /*nothrow*/ { // allow this to be nothrow
if (pos.isNull) {
return;
} else {
a[pos] = 10; // perform no nullness test here, optimization
}
}

void bar(int[] a, Position pos) {
a[pos] = 10; // compile-time error here?
}

void main() {
auto data = [1, 2, 3, 4, 5];
auto p = Position(countUntil(data, 7));
foo(data, p);
writeln(data);
}

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