[Issue 4302] New: compiler errors using startsWith in CTFE

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

   Summary: compiler errors using startsWith in CTFE
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: rejects-valid
  Severity: regression
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: r.sagita...@gmx.de


--- Comment #0 from Rainer Schuetze r.sagita...@gmx.de 2010-06-13 01:17:32 
PDT ---
the following code fails with dmd 2.047:

import std.algorithm;

const bool var = startsWith(ab, a);

dmd output:

c:\l\dmd2\windows\bin\..\..\src\phobos\std\functional.d(176): Error: static
assert  Bad binary function q{a == b}. You need to use a valid D expression
using symbols a of type dchar and b of type string.
c:\l\dmd2\windows\bin\..\..\src\phobos\std\functional.d(179):   
instantiated from here: Body!(dchar,string)
c:\l\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(1983):   
instantiated from here: result!(dchar,string)

the error disappears if you remove the const.

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


[Issue 4302] compiler errors using startsWith in CTFE

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



--- Comment #1 from Rainer Schuetze r.sagita...@gmx.de 2010-06-13 01:23:38 
PDT ---
I've tried to untangle the startsWith code, and here's the minimal test case I
could come up with so far:

///
template binaryFunImpl(bool b)
{
   template Body()
   {
   static assert(b);
   alias bool BodyType;
   }
   alias Body!().BodyType  ReturnType;  // line 9
}

uint startsWith(A)(A a) if (is(binaryFunImpl!(true ).ReturnType)) { return 1; }
uint startsWith(A)(A a) if (is(binaryFunImpl!(false).ReturnType)) { return 0; }
 // line 13

const uint var = startsWith(1);
///
dmd produces:

test.d(6): Error: static assert  (b) is false
test.d(9):instantiated from here: Body!()
test.d(13):instantiated from here: binaryFunImpl!(false)

The error does not show up if var is not const. Also, dmd 2.032 to 2.045 do not
produce this error (2.046 fails), so it seems a compiler regression being
triggered with the new implementation of startsWith.

This is what happens:

while deducing a template match,
- a template instance of binaryFunImpl!false is created to evaluate
is(binaryFunImpl!(false).ReturnType)
- the template instance is added as a member to the module (template.c(3779))
- semantic analysis fails, so the respective startsWith alternative is rejected
- compiler attempts to compile added binaryFunImpl!false and fails

maybe, the template instance should be removed from the module member list at
template.c(3975)

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


[Issue 4304] New: default arguments using delegates of a global object no longer work

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

   Summary: default arguments using delegates of a global object
no longer work
   Product: D
   Version: D1
  Platform: Other
OS/Version: Mac OS X
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: fa...@gmx.ch


--- Comment #0 from Fawzi Mohamed fa...@gmx.ch 2010-06-13 09:48:53 PDT ---
with dmd 1.062
{{{
class A{
int f(int a){
return a;
}
static A defaultA;
static this(){
defaultA=new A();
}
}

void f(int delegate(int) arg=A.defaultA.f){
arg(2);
}

void defaultCall(){
f();
}
}}}

fails with Error: cannot inline default argument defaultA.f

whereas it did work previously.

This might be indeed correct if the compiler cannot guarantee that the correct
value of defaultA is used (i.e. after the static initializer).

It seemed to work correctly in my use case, and the fact that setting defaultA
to another value is most probably not seen by default value shows that using
null as default value, and an 
if (arg is null) arg=A.defaultA.f;
in the body is probably a better solution.

I still submit it here, but most likely this change is a feature, not a bug.

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


[Issue 4305] New: Take, Chain on top of ranges w/o moveFront()

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

   Summary: Take, Chain on top of ranges w/o moveFront()
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: dsim...@yahoo.com


--- Comment #0 from David Simcha dsim...@yahoo.com 2010-06-13 11:51:14 PDT ---
import std.range;

struct CountRange {
uint num;

uint front() {
return num;
}

void popFront() {
num++;
}

bool empty() @property {
return num == uint.max;
}

typeof(this) save() @property {
return this;
}
}

void main() {
CountRange cr;
auto t = take(cr, 100); 
}

This produces a compile time error:
d:\dmd2\windows\bin\..\..\src\phobos\std\range.d(1289): Error: template
std.range.moveFront(R) if (is(typeof(r.front()) == ElementType!(R)*)) does not
match any function template declaration
d:\dmd2\windows\bin\..\..\src\phobos\std\range.d(1289): Error: template
std.range.moveFront(R) if (is(typeof(r.front()) == ElementType!(R)*)) cannot
deduce template function from argument types !()(CountRange)

Similar results occur when the main block looks like this instead:

void main() {
CountRange cr1;
CountRange cr2;
auto c = chain(cr1, cr2);
}

I guess the correct fix is to just stick moveFront() in a static if block and
disable it for ranges that don't have lvalue elements.  However, I'd like to
get some comments in case I'm misunderstanding the issue here.

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


[Issue 2636] std.math.pow should be a template

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


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||WONTFIX


--- Comment #8 from Don clugd...@yahoo.com.au 2010-06-13 13:03:54 PDT ---
I do not think it is possible to change this in D1 without breaking existing
code.

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


[Issue 3873] std.range.repeat should have popBack defined

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


Masahiro Nakagawa repeate...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #2 from Masahiro Nakagawa repeate...@gmail.com 2010-06-13 
13:08:38 PDT ---
Fixed dmd 2.047.

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


[Issue 4306] New: std.numeric.CustomFloat doesn't work on Mac OS X.

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

   Summary: std.numeric.CustomFloat doesn't work on Mac OS X.
   Product: D
   Version: D2
  Platform: Other
OS/Version: Mac OS X
Status: NEW
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: repeate...@gmail.com


--- Comment #0 from Masahiro Nakagawa repeate...@gmail.com 2010-06-13 
14:01:40 PDT ---
I tested following code using dmd 2.047 on Mac OS X 10.6.3.

-
import std.numeric;

void main()
{
CustomFloat!16 a;
}
-

compilation result:

std/numeric.d(476): Error: template instance ToBinary!(real) does not match
template declaration ToBinary(F) if (is(CustomFloat!(F.sizeof * 8)))
std/numeric.d(476): Error: ToBinary!(real) is used as a type
std/numeric.d(476): Error: variable
std.numeric.CustomFloat!(precision,exponentWidth,flags,15).CustomFloat.get!(real).get.result
voids have no value

I think this cause is real type size. real.sizeof is 16 on Mac OS X, but
current std.numeric.CustomFloat can't treat those environments.

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


[Issue 3876] std.range.Take back/popBack methods don't work correctly

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


Shin Fujishiro rsi...@gmail.com changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution||FIXED


--- Comment #3 from Shin Fujishiro rsi...@gmail.com 2010-06-13 15:48:47 PDT 
---
The O(n) constructor was removed.  Fixed in the release 2.047.

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


[Issue 4306] std.numeric.CustomFloat doesn't work on Mac OS X.

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


David Simcha dsim...@yahoo.com changed:

   What|Removed |Added

 CC||dsim...@yahoo.com


--- Comment #1 from David Simcha dsim...@yahoo.com 2010-06-13 16:35:44 PDT ---
This code was initially only tested on Windows, which doesn't use this padding.
 Linux also uses padding, though to 12 bytes instead of 16.  I've checked in a
fix that works on Linux.  It should work for Mac, too but I can't test it
because I don't own a Mac.  Please let me know whether it does.

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


[Issue 4272] x.typeof syntax

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


Trass3r mrmoc...@gmx.de changed:

   What|Removed |Added

 CC||mrmoc...@gmx.de


--- Comment #1 from Trass3r mrmoc...@gmx.de 2010-06-13 17:49:40 PDT ---
Then typeid should probably also be .typeid instead of typeid()

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


[Issue 4307] New: spawn()'ed thread doesn't terminate

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

   Summary: spawn()'ed thread doesn't terminate
   Product: D
   Version: D2
  Platform: x86
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: to...@yahoo.com


--- Comment #0 from to...@yahoo.com 2010-06-13 18:50:11 PDT ---
Using DMD 2.047.

This example hangs after printing '9'.  From reading Andrei's book, my
understanding is that the spawned thread should terminate automatically when
its owner thread terminates.  But that doesn't happen here.

---
import std.concurrency;
import std.stdio;

void f()
{
for (;;)
{
int i = receiveOnly!int();
writeln(i);
}
}

void main()
{
Tid tid = spawn(f);
foreach (int i; 0..10)
{
send(tid, i);
}
}
---

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


[Issue 4305] Take, Chain on top of ranges w/o moveFront()

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


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

   What|Removed |Added

 CC||and...@metalanguage.com
 AssignedTo|nob...@puremagic.com|and...@metalanguage.com


--- Comment #1 from Andrei Alexandrescu and...@metalanguage.com 2010-06-13 
20:54:52 PDT ---
The intent is to allow manipulation of ranges that contain types arbitrarily
expensive to copy. The current design requires either front() to yield a ref,
or the range to define moveFront().

I think a better design is to define the module-level std.range.moveFront() to
issue a simple copy when the type being copied does not define this(this). I'll
do so soon. Thanks!

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


[Issue 4305] Take, Chain on top of ranges w/o moveFront()

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


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

   What|Removed |Added

 Status|NEW |ASSIGNED


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


[Issue 4308] New: Extract the grammar from the docs for easy processing

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

   Summary: Extract the grammar from the docs for easy processing
   Product: D
   Version: D1  D2
  Platform: Other
OS/Version: Other
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: shro8...@vandals.uidaho.edu


--- Comment #0 from BCS shro8...@vandals.uidaho.edu 2010-06-13 22:18:14 PDT 
---
Created an attachment (id=660)
a patch to the language documentation

Moving all the grammar documentation into one file provides several advantages.

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


[Issue 3541] Add -oq to dmd (use fully qualified module name as object filename)

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



--- Comment #6 from nfx...@gmail.com 2010-06-13 22:20:53 PDT ---
For dmd 1.062, watch out for the comment // Bugzilla 3547 in module.c: you
have to move my changes into the indented new indented else branch.

Not bothering with a real updated patch, line ending issues make this kind of
infeasible, and Walter probably applies patches manually anyway. (Plus he
obviously isn't interested in this.)

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


[Issue 4308] Extract the grammar from the docs for easy processing

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


Brad Roberts bra...@puremagic.com changed:

   What|Removed |Added

Attachment #660|application/octet-stream|text/plain
  mime type||
 Attachment #660 is|0   |1
  patch||


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