[Issue 6764] New: IFTI fails on typesafe variadic function over static array with non IntegerLiteral length

2011-10-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6764

   Summary: IFTI fails on typesafe variadic function over static
array with non IntegerLiteral length
   Product: D
   Version: D1  D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: minor
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: verylonglogin@gmail.com


--- Comment #0 from Denis verylonglogin@gmail.com 2011-10-03 23:14:20 PDT 
---
---
enum N = 1; //use const for D1

alias size_t[N] T; //workaround
void f()(T arr...) { }

void g()(size_t[1] arr...) { }

void h()(size_t[N] arr...) { }

void main()
{
f(0);//good
g(0);//good
h!()(0); //good
h(0);//Error: template main.f() does not match any function template
declaration
}
---

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


[Issue 1891] Array-concatenation of T* and T*[] produces corrupted result

2011-10-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1891


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

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution||FIXED


--- Comment #3 from Walter Bright bugzi...@digitalmars.com 2011-10-04 
01:47:51 PDT ---
https://github.com/D-Programming-Language/dmd/commit/51d83859ec2440f90ca1625640358502372b1465

https://github.com/D-Programming-Language/dmd/commit/411fdb0f7b391a028d40ec888b63d44ebcb646bb

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


[Issue 6765] New: [CTFE]: AA.length doesn't compile when AA is null

2011-10-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6765

   Summary: [CTFE]: AA.length doesn't compile when AA is null
   Product: D
   Version: D1  D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don clugd...@yahoo.com.au 2011-10-04 05:53:43 PDT ---
At compile time, if an AA is null, then AA.length is zero.

int main()
{
int[int] w;
return w.length; // OK
}

But:

static assert({
int[int] w;
return w.length;
}()==0);

fails with:
\..\src\druntime\import\object.di(362): Error: _aaLen cannot be interpreted at
compile time, because it has no available source code

Both D1 and D2.

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


[Issue 6766] New: Forward reference error for default struct/class arguments

2011-10-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6766

   Summary: Forward reference error for default struct/class
arguments
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: andrej.mitrov...@gmail.com


--- Comment #0 from Andrej Mitrovic andrej.mitrov...@gmail.com 2011-10-04 
09:35:05 PDT ---
void test(Bar bar = Bar(1)) { }

struct Bar
{
this(int x) { }
}
void main() { }

Error: more initializers than fields of Bar

This also affects structs and classes that have methods with default arguments
that call ctors of typeof(this):

class Foo
{
this(int x) { }
void test(Foo foo = new Foo(1)) { }
}

struct Bar
{
this(int x) { }
void test(Bar bar = Bar(1)) { }
}

void main() {}

test.d(4): Error: no constructor for Foo
test.d(10): Error: more initializers than fields of Bar

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


[Issue 6767] New: Range case statements generate horrific code

2011-10-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6767

   Summary: Range case statements generate horrific code
   Product: D
   Version: D2
  Platform: x86
OS/Version: Mac OS X
Status: NEW
  Severity: major
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: peter.alexander...@gmail.com


--- Comment #0 from Peter Alexander peter.alexander...@gmail.com 2011-10-04 
10:43:04 PDT ---
int foo(int n)
{
  switch (n)
  {
  case 0: .. case 255:
return 0;

  default:
return 1;
  }
}

Compiled with all optimisation (-O -inline -release) in DMD 2.055, I get the
following code generated (it's the same without optimisation, too):


_D4test3fooFiZi:
1bb4pushl%ebp
1bb5movl%esp,%ebp
1bb7pushl%eax
1bb8testl%eax,%eax
1bbaje0x2571
1bc0cmpl$0x01,%eax
1bc3je0x2571
1bc9cmpl$0x02,%eax
1bccje0x2571
1bd2cmpl$0x03,%eax
1bd5je0x2571
1bdbcmpl$0x04,%eax
1bdeje0x2571
1be4cmpl$0x05,%eax
1be7je0x2571

... for all 256 values ...

255acmpl$0x00fd,%eax
255fje0x2571
2561cmpl$0x00fe,%eax
2566je0x2571
2568cmpl$0x00ff,%eax
256dje0x2571
256fjmp0x2577
2571movl%ebp,%esp
2573xorl%eax,%eax
2575popl%ebp
2576ret
2577movl%ebp,%esp
2579movl$0x0001,%eax
257epopl%ebp
257fret


Essentially, it has generated a massive O(n) function for what should be a
couple of compares if not better.

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


[Issue 6056] Type lookup problem in string mixins

2011-10-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6056


Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

   Keywords||patch, rejects-valid


--- Comment #3 from Kenji Hara k.hara...@gmail.com 2011-10-04 11:39:25 PDT ---
string-mixin is also not needed.

alias const(typeof('c')*) A;
alias const(typeof(0)*) B;
static assert(is(B == const(int*)));

And template instance has same issue.

template X(T) { alias T X; }
alias const(X!char*) A;
alias const(X!int*) B;
static assert(is(B == const(int*)));

Patch:
https://github.com/D-Programming-Language/dmd/pull/430

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


[Issue 6378] Overriding opAssign disables ability to null a reference

2011-10-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6378


Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||DUPLICATE


--- Comment #1 from Kenji Hara k.hara...@gmail.com 2011-10-04 13:22:11 PDT ---
*** This issue has been marked as a duplicate of issue 6630 ***

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


[Issue 6758] std.c.stdarg problems with 8 or more integer arguments on x86_64

2011-10-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6758



--- Comment #6 from Graham grahamc00...@yahoo.co.uk 2011-10-04 16:29:52 PDT 
---
Perhaps somebody can tell me if D-style variadic functions really should be
using the __va_argsave structure on x86_64 code or should that only be
applicable to C-style variadic functions (as the documentation still implies at
the moment).

The compiler appears to be using the __va_argsave method of argument passing
for both C and D variadic functions on x86_64 code. So it's only possible to
use _argptr for retrieving arguments (as the documentation says) on 32 bit
code.

I have managed to patch stdarg.d (D1) and stdarg.di (D2) to work with most D
argument types but cfloat still gives some problems.

If this is a compiler issue (wrong argument passing method being used for D
variadic functions) then I'll stop expending any more time on it.

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


[Issue 6768] New: Problem with init of struct members in presence of templated opAssign

2011-10-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6768

   Summary: Problem with init of struct members in presence of
templated opAssign
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: critical
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: andrej.mitrov...@gmail.com


--- Comment #0 from Andrej Mitrovic andrej.mitrov...@gmail.com 2011-10-04 
19:14:34 PDT ---
module test;

import std.traits;
import std.stdio;

struct Point 
{
int x, y;
void delegate() dg;

// void opAssign(void delegate() rhs)  // ok, x and y initialized
// {
// dg = rhs;
// }

void opAssign(T)(T rhs) if (isDelegate!T)  // x and y left uninitialized
{
dg = rhs;
}

void test() { dg(); }
}

class Foo
{
this() 
{ 
point = { writefln(Point: %s, point); };  // assign delegate
}

Point point;
}

void main()
{
auto foo = new Foo;
foo.point.dg();// x and y are initialized
foo.point.test();  // but here x and y are not initialized (??)
foo.point.dg();// again, not initialized (??)
}



I don't understand how calling dg() directly or indirectly via test() prints
different results for x and y. If I use the non-templated version of opAssign
then both calls are fine, with x and y being zero-inited.

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