[Issue 4028] delegates with differing default arguments lead to same template instantiation

2010-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4028



--- Comment #4 from Don clugd...@yahoo.com.au 2010-04-07 23:56:51 PDT ---
The two delegates *are* the same type, so they are supposed to lead to the same 
template instantiation. Introducing a default parameter does not create a new 
type.
I'm not sure why function pointers with default parameters are accepted at all. 
I think it should be an error.

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


[Issue 4072] New: Stack overflow on recursive template expansion inside contract

2010-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4072

   Summary: Stack overflow on recursive template expansion inside
contract
   Product: D
   Version: 2.040
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: ice-on-invalid-code, patch
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don clugd...@yahoo.com.au 2010-04-08 06:18:01 PDT ---
void bug4072(T)(T x)
   if (is(typeof(bug4072(x
{}

static assert(!is(typeof(bug4072(7;

-
PATCH:

template.c line 1421.
---
Objects dedargs;
+static int nest = 0;
+if (++nest  300)
+{
+global.gag = 0;// ensure error message gets printed
+error(recursive expansion);
+if (sc-tinst) sc-tinst-printInstantiationTrace();
+fatal();
+}
m = td-deduceFunctionTemplateMatch(loc, targsi, ethis, fargs,
dedargs);
+--nest;
//printf(deduceFunctionTemplateMatch = %d\n, m);
if (!m) // if no match
continue;

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


[Issue 4073] New: core.cpuid crashes

2010-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4073

   Summary: core.cpuid crashes
   Product: D
   Version: 2.041
  Platform: Other
OS/Version: Mac OS X
Status: NEW
  Severity: normal
  Priority: P2
 Component: druntime
AssignedTo: s...@invisibleduck.org
ReportedBy: bio...@free.fr


--- Comment #0 from biozic bio...@free.fr 2010-04-08 06:29:14 PDT ---
The following code crashes at runtime on Mac OS X, when executing 
---
import core.cpuid;
void main() {}
---

Trace:
0x3405 D4core5cpuid8cpuidX86FZv + 37
0x2a11 D4core5cpuid18_sharedStaticCtor1FZv + 29
0x29af _D4core5cpuid15__modsharedctorFZv + 11
0xc1c2 D6object12_moduleCtor2FAPS6object10ModuleInfoiZv + 306
0xc236 D6object12_moduleCtor2FAPS6object10ModuleInfoiZv + 422
0xc02a _moduleCtor + 114
0xdf7e D2rt6dmain24mainUiPPaZi6runAllMFZv + 26
0xdcde D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv + 42
0xdc6c main + 168
0x248d start + 53

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


[Issue 4074] New: function overloading fails

2010-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4074

   Summary: function overloading fails
   Product: D
   Version: 1.057
  Platform: x86
OS/Version: Windows
Status: NEW
  Severity: major
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: digi...@yandex.ru


--- Comment #0 from Eugene Zheleznikoff digi...@yandex.ru 2010-04-08 06:42:39 
PDT ---
Created an attachment (id=605)
archive with source code

module common;

class A {}
class B {}

//--

module import1;

import common;

void foo(B b) {}

//--

module import2;

import common;

void foo(A a) {}

//--

module test;

import common, import1, import2;

void main()
{
auto b = new B;
foo(b);
}

//--

dmd test.d common.d import1.d import2.d
test.d(8): Error: import1.foo at import1.d(5) conflicts with import2.foo at
import2.d(5)

reproduced on WinXP with DMD 1.051 and 1.057


workaround:

module test;

import common;

import import1 : fooo = foo;
import import2 : fooo = foo;

void main()
{
auto b = new B;
fooo(b);
}

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


[Issue 3520] std.numeric.CustomFloat horribly broken

2010-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3520


Rob Jacques sandf...@jhu.edu changed:

   What|Removed |Added

 CC||sandf...@jhu.edu
   Severity|normal  |regression


--- Comment #3 from Rob Jacques sandf...@jhu.edu 2010-04-08 09:30:55 PDT ---
There seems to be an additional problem with custom float. In DMD 2.039 and
2.042 it doesn't compile. I've developed a hack/patch around this issue.

For example:
CustomFloat!(1, 5, 10) temp;

Error: this for signfractionexponent needs to be type CustomFloat not type
CustomFloat!(1,5,10)
Error: struct std.numeric.CustomFloat!(1,5,10).CustomFloat member
signfractionexponent is not accessible
Error: template instance std.numeric.CustomFloat!(1,5,10) error instantiating

I've been able to reduce the code to a test case

struct CustomFloat(
bool signBit,   
uint fractionBits,  
uint exponentBits,
//uint bias = (1u  (exponentBits - 1)) - 1// This is the problem
CustomFloatFlags flags = CustomFloatFlags.all
)
{

float foo;
float bar() { return foo;}
F get(F)() { return 1; }
}

however, when I try this as independent test case, the bug isn't reproduced. 

As a quick patch I've move bias from a template parameter to the struct body as
an enum:

struct CustomFloat(
bool signBit,   // allocate a sign bit? (true for float)
uint fractionBits,  // fraction bits (23 for float)
uint exponentBits,
//uint bias = (1u  (exponentBits - 1)) - 1
CustomFloatFlags flags = CustomFloatFlags.all)
{
enum bias = (1u  (exponentBits - 1)) - 1;
...

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


[Issue 3520] std.numeric.CustomFloat horribly broken

2010-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3520



--- Comment #4 from Rob Jacques sandf...@jhu.edu 2010-04-08 10:49:06 PDT ---
The bit layout of custom float is not IEEE compliant and can't be used to
represent half, float nor double types.

Here's the correct layout
private mixin(bitfields!(
  uint, fraction, fractionBits,
  uint, exponent, exponentBits,
  bool,   sign,   signBit));

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


[Issue 4072] Stack overflow on recursive template expansion inside contract

2010-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4072


Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

 CC||bugzi...@digitalmars.com


--- Comment #1 from Walter Bright bugzi...@digitalmars.com 2010-04-08 
13:59:47 PDT ---
changeset 432

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


[Issue 4071] Missing support to share memory and objects between DLLs and executable

2010-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4071



--- Comment #7 from Rainer Schuetze r.sagita...@gmx.de 2010-04-08 14:29:59 
PDT ---
I'm not sure the way you did it on OSX is feasable on Windows aswell, because
you might not have access to all the info in the DLLs (maybe it's possible if
you export all necessary symbols in each DLL). But I guess it will not work for
dynamically loaded DLLs. My implementation does not need a supervising
function to run initializers, each binary just initializes the part it
contains.

I haven't done anything with respect to exception handling, but if I understand
it correctly, the exception frames are local to the functions and binary they
belong to, so they still are unwinded correctly. A simple test (catching an
exception from inside phobos.dll) was working correctly.

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


[Issue 4021] [CTFE] AA rehash

2010-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4021



--- Comment #2 from Michael Rynn y0uf00...@gmail.com 2010-04-08 18:22:50 PDT 
---
// I feel obliged to submit a version of function _aaRehash that ignores the
TypeInfo passed to it, to make the keyti argument redundent. (
druntime/src/rt/aaA.d).

void* _aaRehash(AA* paa, TypeInfo keyti)
{
BB newb;

TypeInfo origti;

void _aaRehash_x(aaA* olde)
{
while (1)
{
auto left = olde.left;
auto right = olde.right;
olde.left = null;
olde.right = null;

aaA *e;

//printf(rehash %p\n, olde);
auto key_hash = olde.hash;
size_t i = key_hash % newb.b.length;
auto pe = newb.b[i];
while ((e = *pe) !is null)
{
//printf(\te = %p, e.left = %p, e.right = %p\n, e, e.left,
e.right);
assert(e.left != e);
assert(e.right != e);
if (key_hash == e.hash)
{
auto c = origti.compare(olde + 1, e + 1);
assert(c != 0);
pe = (c  0) ? e.left : e.right;
}
else
pe = (key_hash  e.hash) ? e.left : e.right;
}
*pe = olde;

if (right)
{
if (!left)
{   olde = right;
continue;
}
_aaRehash_x(right);
}
if (!left)
break;
olde = left;
}
}

//printf(Rehash\n);
if (paa.a)
{
auto aa = paa.a;
auto len = _aaLen(*paa);

if (len)
{
size_t i;

origti = aa.keyti;
for (i = 0; i  prime_list.length - 1; i++)
{
if (len = prime_list[i])
break;
}
len = prime_list[i];
newb.b = new aaA*[len];

foreach (e; aa.b)
{
if (e)
_aaRehash_x(e);
}
delete aa.b;

newb.nodes = aa.nodes;
newb.keyti = aa.keyti;
}

*paa.a = newb;
_aaBalance(paa);
}
return (*paa).a;
}

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