[Issue 4298] Constant array translated to unnecessary array literal creation

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


David Simcha  changed:

   What|Removed |Added

 CC||r.sagita...@gmx.de


--- Comment #5 from David Simcha  2010-09-08 20:11:40 PDT ---
*** Issue 4631 has been marked as a duplicate of this issue. ***

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


[Issue 4631] const array literal rebuilt on every usage

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


David Simcha  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||dsim...@yahoo.com
 Resolution||DUPLICATE


--- Comment #1 from David Simcha  2010-09-08 20:11:39 PDT ---
*** This issue has been marked as a duplicate of issue 4298 ***

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


[Issue 4842] New: Wrong code with template literals

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

   Summary: Wrong code with template literals
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: wrong-code
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: dsim...@yahoo.com


--- Comment #0 from David Simcha  2010-09-08 20:02:38 PDT ---
The following code was written for Rosetta Code and is intended to find all
factors of an integer.  It produces wrong results.  The exact wrong results
depend on whether inlining is enabled.

import std.range, std.algorithm, std.stdio;

auto factors(I)(I num) {
return filter!((i) { return num % i == 0; })(
iota(1, num + 1)
);
}

void main() {
writeln(factors(36));
}


If I change the line with the lambda from a template literal to a delegate
literal:

return filter!((I i) { return num % i == 0; })

then it works.

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


[Issue 4382] Same syntax to access items of Proxy and Tuple and more

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



--- Comment #2 from bearophile_h...@eml.cc 2010-09-08 11:10:14 PDT ---
Probably fixed here:

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

http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=117082

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


[Issue 4836] "duplicated union initialization" without a union

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



--- Comment #1 from Ivo Kasiuk  2010-09-08 11:06:48 PDT ---
Also, line 6 seems to have no influence, so the following still does not
compile:

class C {
  string s = null;
  mixin template M() { }
  mixin M!() m1;
  mixin template M(T) { }
}

On the other hand, when replacing "string s = null" by "int i = 0" it compiles
without error.

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


[Issue 2740] Template Mixins do not work as advertised

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



--- Comment #3 from David Simcha  2010-09-08 10:42:34 PDT ---
Oh yeah, doesn't happen for abstract classes either.  Looks like only the
interface vtbl info is wrong.

import std.stdio;

abstract class IFooable {
  abstract bool foo();
}

mixin template TFoo() {
  override bool foo() { return true; }
}

class Foo : IFooable {
  mixin TFoo;
  override bool foo() { return false; }
}

void go(IFooable p) {
  writeln(p.foo);
}

void main() {
  Foo p = new Foo();
  go(p);// false
  writeln(p.foo);   // false
  IFooable i = p;
  writeln(i.foo);   // false
}

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


[Issue 2740] Template Mixins do not work as advertised

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


David Simcha  changed:

   What|Removed |Added

 CC||dsim...@yahoo.com
   Severity|normal  |critical


--- Comment #2 from David Simcha  2010-09-08 10:40:17 PDT ---
This seems to happen iff the class is called from its interface handle:

import std.stdio;

interface IFooable {
  bool foo();
}

mixin template TFoo() {
  override bool foo() { return true; }
}

class Foo : IFooable {
  mixin TFoo;
  override bool foo() { return false; }
}

void go(IFooable p) {
  writeln(p.foo);
}

void main() {
  Foo p = new Foo();
  go(p);// true
  writeln(p.foo);   // false
  IFooable i = p;
  writeln(i.foo);   // true
}

Marking as critical because this is an extremely subtle wrong-code bug that can
lead to some pretty frustrating debugging.

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


[Issue 4838] Cannot declare a delegate variable for const member functions

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



--- Comment #7 from Don  2010-09-08 07:11:58 PDT ---
General comment: You have to be careful with .stringof, it's not yet reliable
(a difference in .stringof doesn't necessarily mean a difference in type). But
.mangleof never lies. The conclusion in this case is still correct, though.

A workaround for the original problem is to use auto (or typeof).

   pragma( msg, (&a.foo).mangleof );
   auto dg = &a.foo;  // this works
   const void delegate() dg2 = &a.foo;
   pragma(msg, dg.mangleof);
   pragma(msg, dg2.mangleof);
---
DxFZv
DxFZv
xDFZv

What I said still applies -- it's a parsing problem.

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


[Issue 4838] Cannot declare a delegate variable for const member functions

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



--- Comment #6 from klickverbot  2010-09-08 06:26:46 PDT 
---
(In reply to comment #5)
> It appears that you can remove the const decorations at will.  This is very 
> not
> good.

See also: bug 1983.

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


[Issue 4838] Cannot declare a delegate variable for const member functions

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


Steven Schveighoffer  changed:

   What|Removed |Added

 CC||schvei...@yahoo.com


--- Comment #5 from Steven Schveighoffer  2010-09-08 
06:25:16 PDT ---
Yes, it does:

import std.stdio;

class A
{
void f() const {}
}

void main()
{
A a = new A;
auto g1 = &a.f;
writefln("g1 = %s", typeof(g1).stringof);
const void delegate() g2 = &a.f;
writefln("g2 = %s", typeof(g2).stringof);
void delegate() g3 = &a.f;
writefln("g3 = %s", typeof(g3).stringof);
g1();
g2();
g3();
}

compiles and outputs:

g1 = void delegate() const
g2 = const(void delegate())
g3 = void delegate()


It appears that you can remove the const decorations at will.  This is very not
good.

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


[Issue 3979] Order-of-compilation and forward reference errors

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


Steven Schveighoffer  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Depends on||190, 4753
 Resolution|FIXED   |


--- Comment #9 from Steven Schveighoffer  2010-09-08 
05:33:34 PDT ---
Reopened, Walter reverted the changes that fix this in
http://www.dsource.org/projects/dmd/changeset/652

It appears that 4753 has an updated patch, can be applied soon?

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


[Issue 4753] fail_compilation/fail116.d sends dmd into a loop, exhausting memory

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


Don  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #4 from Don  2010-09-08 05:07:39 PDT ---
This was fixed by reverting svn 634. If the patch in bug 190 is re-used, this
patch here should be applied as well.

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


[Issue 4841] New: An array()/map inlining problem

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

   Summary: An array()/map inlining problem
   Product: D
   Version: D2
  Platform: x86
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2010-09-08 04:08:00 PDT ---
This is a D2 program:


import std.algorithm: map;
import std.array: array;
void main() {
int c;
array(map!((x){return c;})([1]));
}


It works if you compile it with dmd 2.048 with:
dmd test.d

But if use inlining:
dmd -inline test.d
It doesn't compile and dmd returns:
test.d(5): Error: function D main is a nested function and cannot be accessed
from array

I think this is a compiler bug because inlining should not affect the
compilability of a program.

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


[Issue 4826] Regression(2.041) "cannot create associative array" and compiler crash

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


Don  changed:

   What|Removed |Added

   Keywords||patch
Summary|"cannot create associative  |Regression(2.041) "cannot
   |array" and compiler crash   |create associative array"
   ||and compiler crash
   Severity|normal  |regression


--- Comment #6 from Don  2010-09-08 03:56:59 PDT ---
The original test case, and the one in comment 4, have slightly different
causes. In comment 4, the problem is that AssociativeArray!() needs a scope, so
that it can be instantiated. This is fixed by in the template.c patch. I
believe that 'sc' is a correct scope, but I'm not certain.

The original test case is fixed by the patch to mtype.c. It's just error
suppression.

Finally, I have a third test case which didn't even work on 2.040. This
compiles when both patches are in place.

void bug4826c(T)(int[int] value, T x) {}

void test4826c()
{
   AssociativeArray!(int, int) z;
   bug4826c(z,1);
}



// Type::deduceType(), template.c line 1920
if (ty != tparam->ty)
+{
+// Can't instantiate AssociativeArray!() without a scope
+if (tparam->ty == Taarray && !((TypeAArray*)tparam)->sc)
+((TypeAArray*)tparam)->sc = sc;
return implicitConvTo(tparam);
+}
//  goto Lnomatch;

if (nextOf())
return nextOf()->deduceType(sc, tparam->nextOf(), parameters,
dedtypes);

Lexact:
return MATCHexact;

--
Also: mtype.c, line 7000.

MATCH TypeStruct::implicitConvTo(Type *to)
{   MATCH m;

//printf("TypeStruct::implicitConvTo(%s => %s)\n", toChars(),
to->toChars());
if (to->ty == Taarray)
+{
+// If there is an error instantiating AssociativeArray!(), it
shouldn't
+// be reported -- it just means implicit conversion is impossible.
+++global.gag;
+int errs = global.errors;
to = ((TypeAArray*)to)->getImpl()->type;
+--global.gag;
+if (errs != global.errors)
+{   global.errors = errs;
+return MATCHnomatch;
+}
+}

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


[Issue 4700] to!float("0") fails

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


Nick Sabalausky  changed:

   What|Removed |Added

 CC||pelle.mans...@gmail.com


--- Comment #2 from Nick Sabalausky  2010-09-08 
02:50:37 PDT ---
*** Issue 4840 has been marked as a duplicate of this issue. ***

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


[Issue 4840] std.conv.to!(float/double/real)("0") errors out

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


Nick Sabalausky  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||cbkbbej...@mailinator.com
 Resolution||DUPLICATE


--- Comment #1 from Nick Sabalausky  2010-09-08 
02:50:37 PDT ---
This is a duplicate of #4700:
http://d.puremagic.com/issues/show_bug.cgi?id=4700

*** This issue has been marked as a duplicate of issue 4700 ***

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


[Issue 4838] Cannot declare a delegate variable for const member functions

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



--- Comment #4 from klickverbot  2010-09-08 02:41:01 PDT 
---
(In reply to comment #3)
> const void delegate() dg = &a.foo;

Would not that rather create a const(void delegate())?

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


[Issue 4838] Cannot declare a delegate variable for const member functions

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


Don  changed:

   What|Removed |Added

 CC||clugd...@yahoo.com.au


--- Comment #3 from Don  2010-09-08 02:21:14 PDT ---
(In reply to comment #2)
> Okay, bearophile, here you go:
> 
> ---
> class A {
>void foo() const {}
> }
> 
> void main() {
>A a = new A;
> 
>pragma( msg, typeof( &a.foo ) ); // Yields �void delegate() const�
>void delegate() const dg = &a.foo; // Does not compile.
> }
> ---
> 
> The error message for this simple case is �test.d(9):
> const/immutable/shared/inout attributes are only valid for non-static member
> functions
> �.

Change that last line to:

const void delegate() dg = &a.foo;

and it works.
It's a parsing issue. I'm sure it's a dup of another bug.

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


[Issue 4838] Cannot declare a delegate variable for const member functions

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



--- Comment #2 from klickverbot  2010-09-08 02:13:36 PDT 
---
Okay, bearophile, here you go:

---
class A {
   void foo() const {}
}

void main() {
   A a = new A;

   pragma( msg, typeof( &a.foo ) ); // Yields �void delegate() const�
   void delegate() const dg = &a.foo; // Does not compile.
}
---

The error message for this simple case is �test.d(9):
const/immutable/shared/inout attributes are only valid for non-static member
functions
�.

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


[Issue 3157] [patch] Pipes should be closed with pclose

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



--- Comment #2 from Brad Roberts  2010-09-08 02:07:01 PDT 
---
Created an attachment (id=750)
updated and slightly alternate implmentation

This patch makes me a little ill.. abusing an exception to propagate more data
because the File abstraction around the pipe is a poor fit.

BUT, I really want to be able to get both the string output as well as it's
result code.  So.. thoughts?

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


[Issue 4840] New: std.conv.to!(float/double/real)("0") errors out

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

   Summary: std.conv.to!(float/double/real)("0") errors out
   Product: D
   Version: D2
  Platform: Other
OS/Version: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: pelle.mans...@gmail.com


--- Comment #0 from Pelle M�nsson  2010-09-08 01:40:29 
PDT ---
It attempts to fetch the front of an empty array on the string "0".

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