[Issue 5996] [CTFE] Undefined function call in auto return function

2011-07-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5996



--- Comment #2 from bearophile_h...@eml.cc 2011-07-06 03:20:22 PDT ---
(In reply to comment #1)
 Reduced test case:

My second example shows an error message with missing line number:
Error: array index 4294967295 is out of bounds [][0 .. 0]

I have reduced it to this, I think it's better to fix this before fixing your
reduced test case:

auto foo(int n) {
auto h = new typeof(something)[n];
return h[$];
}
enum uint f = foo(1);
void main() {}

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


[Issue 6257] New: Struct postblit not called in one case

2011-07-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6257

   Summary: Struct postblit not called in one case
   Product: D
   Version: D2
  Platform: x86
OS/Version: Windows
Status: NEW
  Keywords: wrong-code
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2011-07-06 03:27:03 PDT ---
With DMD 2.053 the second assert of this program fires, is this a DMD bug?


struct Foo {
   int[] data;

   this(int n) {
   data.length = n;
   }

   this(this) {
   data = data.dup;
   }
}
void main() {
   Foo f1, f2;
   f1 = Foo(1);
   f2 = f1;
   assert(f1.data.ptr != f2.data.ptr); // OK
   f1 = f2 = Foo(1);
   assert(f1.data.ptr != f2.data.ptr); // asserts
}

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


[Issue 5996] [CTFE] Undefined function call in auto return function

2011-07-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5996



--- Comment #3 from Don clugd...@yahoo.com.au 2011-07-06 04:21:21 PDT ---
(In reply to comment #2)
 (In reply to comment #1)
  Reduced test case:
 
 My second example shows an error message with missing line number:
 Error: array index 4294967295 is out of bounds [][0 .. 0]
 
 I have reduced it to this, I think it's better to fix this before fixing your
 reduced test case:
 
 auto foo(int n) {
 auto h = new typeof(something)[n];
 return h[$];
 }
 enum uint f = foo(1);
 void main() {}

It's a problem with the gagging system. It actually shouldn't get as far as
CTFE, so the out-of-bounds error shouldn't happen.

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


[Issue 6258] New: std.conv.to!real(-) fetches the front of an empty array.

2011-07-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6258

   Summary: std.conv.to!real(-) fetches the front of an empty
array.
   Product: D
   Version: D2
  Platform: x86
OS/Version: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: kajetan.rzepe...@gmail.com


--- Comment #0 from Kajtek kajetan.rzepe...@gmail.com 2011-07-06 07:43:52 PDT 
---
Instead it should throw ConvException.
Some code and versions:


import std.conv;
void main() {
to!real(-);
//GDC hg, using dmd 2.052 core.exception.AssertError@/.../std/array.d(373):
Attempting to fetch the front of an empty array
//DMD32 D Compiler v2.053 core.exception.AssertError@/.../std/array.d(372):
Attempting to fetch the front of an empty array
//GNU/Linux i686
}

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


[Issue 2850] bad codegen for struct static initializers

2011-07-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2850


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #1 from Don clugd...@yahoo.com.au 2011-07-06 08:07:11 PDT ---
https://github.com/D-Programming-Language/dmd/commit/0af590ebfd1aa1f0994828b1eb666db89d451e4b

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


[Issue 1880] templates instantiated with non-constants should fail sooner

2011-07-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1880


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

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||clugd...@yahoo.com.au
 Resolution||FIXED


--- Comment #2 from Don clugd...@yahoo.com.au 2011-07-06 08:05:37 PDT ---
https://github.com/D-Programming-Language/dmd/commit/fc67046cf1e66182d959309fb15ef9e2d4c266b9

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


[Issue 6192] std.algorithm.sort performance

2011-07-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6192



--- Comment #2 from bearophile_h...@eml.cc 2011-07-06 10:42:20 PDT ---
Was this update in the sort code caused by this enhancement request, or are
they unrelated?

Timings with DMD 2.054beta, a different CPU:


sort-sort2 benchmarks (milliseconds), N=600:
  Random distribution:
sort:1892
sort2:   1131
  Already sorted arrays:
sort: 748
sort2:376
  Inverted order arrays:
sort:1048
sort2:656
  Few random doubles appended to the sorted arrays:
sort:3085
sort2:734


It seems the random case is improved a lot, the already sorted case is
improved, the inverted order is about the same, and the few random values added
case is slower than before.

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


[Issue 5667] [GSoC] clear does not call destructors on structs embedded in structs

2011-07-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5667



--- Comment #3 from Cristi Cobzarenco cristi.cobzare...@gmail.com 2011-07-06 
10:42:33 PDT ---
I think I found a fix, but I'm not sure if it's correct as I don't know much
about the D runtime. In file object_.d, line 2600:

void clear(T)(ref T obj) if (is(T == struct))
{
-   static if (is(typeof(obj.__dtor(
-   {
-   obj.__dtor();
-   }
+   typeid(T).destroy( obj );

auto buf = (cast(ubyte*) obj)[0 .. T.sizeof];
auto init = cast(ubyte[])typeid(T).init();
if(init.ptr is null) // null ptr means initialize to 0s
buf[] = 0;
else
buf[] = init[];
}

This fixes it for me. You need to modifiy import/object.di as well, because
object_.d doesn't get header'd into object.di, for some reason I don't know.

I might make a pull request, but I'm not 100% this is correct, I would like to
get some feedback.

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


[Issue 6192] std.algorithm.sort performance

2011-07-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6192


kenn...@gmail.com changed:

   What|Removed |Added

 CC||kenn...@gmail.com


--- Comment #3 from kenn...@gmail.com 2011-07-06 11:00:55 PDT ---
(In reply to comment #2)
 Was this update in the sort code caused by this enhancement request, or are
 they unrelated?
 
 Timings with DMD 2.054beta, a different CPU:
 
 
 sort-sort2 benchmarks (milliseconds), N=600:
   Random distribution:
 sort:1892
 sort2:   1131
   Already sorted arrays:
 sort: 748
 sort2:376
   Inverted order arrays:
 sort:1048
 sort2:656
   Few random doubles appended to the sorted arrays:
 sort:3085
 sort2:734
 
 
 It seems the random case is improved a lot, the already sorted case is
 improved, the inverted order is about the same, and the few random values 
 added
 case is slower than before.

https://github.com/D-Programming-Language/phobos/pull/74

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


[Issue 6259] New: Property getters returning ref const() cause setters to be hidden

2011-07-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6259

   Summary: Property getters returning ref const() cause setters
to be hidden
   Product: D
   Version: unspecified
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: regression
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: lud...@informatik.uni-luebeck.de


--- Comment #0 from S�nke Ludwig lud...@informatik.uni-luebeck.de 2011-07-06 
12:41:23 PDT ---
The following source will produce the following error on DMD 2.054beta:

bug1.d(10): Error: s.prop is not mutable

---
struct S {
private int m_prop;
ref const(int) prop() { return m_prop; }
void prop(int v) { m_prop = v; } 
}

void test()
{
S s;
s.prop = 1;
}
---

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


[Issue 6259] Property getters returning ref const() cause setters to be hidden

2011-07-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6259



--- Comment #1 from S�nke Ludwig lud...@informatik.uni-luebeck.de 2011-07-06 
12:47:30 PDT ---
Just noticed that the difference to DMD 2.053 and prev. is that the ref const()
getter was not matched for assignments but is now. Declaring the property
setter first makes the code compile again, which seems wrong, as there should
be no reason for the declaration order to matter.

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


[Issue 6260] New: [Memory Corruption] Passed around lazy arguments don't work with closures

2011-07-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6260

   Summary: [Memory Corruption] Passed around lazy arguments don't
work with closures
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Keywords: wrong-code
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: timon.g...@gmx.ch


--- Comment #0 from timon.g...@gmx.ch 2011-07-06 13:29:26 PDT ---
Tested in DMD 2.053:

auto foo(lazy int x){return {return x;};}
auto bar(lazy int x){return foo(x);}

void main(){assert(foo(1)()==bar(1)());} // assertion failure







Workaround:
auto foo(lazy int x){return {return x;};}
auto bar(lazy int x){return foo({return x;}());} // destroy purpose of 'lazy'

void main(){assert(foo(1)()==bar(1)());} // pass


Some funny stuff:
import std.stdio;
void main(){
auto x=bar(1);
writeln(x());
}

writes:
Garbage integer value
0

Where does 0 come from?

void main(){
writeln(bar(1)());
}

writes:
Garbage integer value
Segmentation Fault

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


[Issue 6261] New: [2.054 beta regression] Regex cannot take a char[]

2011-07-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6261

   Summary: [2.054 beta regression] Regex cannot take a char[]
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: jesse.k.phillip...@gmail.com
CC: jesse.k.phillip...@gmail.com


--- Comment #0 from Jesse Phillips jesse.k.phillip...@gmail.com 2011-07-06 
13:30:08 PDT ---
The code below will not compile:

import std.regex;

void main(){
auto re = regex(foo.dup);
}

src\phobos\std\regex.d(1537): Error: cannot cast a
read-only string literal to mutable in CTFE
src\phobos\std\regex.d(1537): Error: cannot evaluate 
tuple(,\x01) at compile time

I think there is a bug report on this, but also notice the instantiation line
isn't given (only the line in regex.d).

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


[Issue 6261] [2.054 beta regression] Regex cannot take a char[]

2011-07-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6261


Dmitry Olshansky dmitry.o...@gmail.com changed:

   What|Removed |Added

 CC||dmitry.o...@gmail.com
  Component|DMD |Phobos
 AssignedTo|nob...@puremagic.com|dmitry.o...@gmail.com
   Severity|normal  |regression


--- Comment #1 from Dmitry Olshansky dmitry.o...@gmail.com 2011-07-06 
14:40:11 PDT ---
Well it's not a bug in DMD. The issue is that CTFE got an upgrade, and detects
more subtle bugs it seems.
The main issue is that it no longer works with mutable patterns.
This also fails:
import std.regex;
void main(){
char[] a = new char[256];
auto re = regex(a);
}

So it's a bug in std.regex, at that exact line. (Again: it is an issue of
sloppy typecheck)
I'll see about a proper fix.

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


[Issue 6261] [2.054 beta regression] Regex cannot take a char[]

2011-07-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6261



--- Comment #2 from Jesse Phillips jesse.k.phillip...@gmail.com 2011-07-06 
16:05:00 PDT ---
I wasn't sure as I didn't really expect any CTFE to be happening.

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


[Issue 6261] [2.054 beta regression] Regex cannot take a char[]

2011-07-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6261


Dmitry Olshansky dmitry.o...@gmail.com changed:

   What|Removed |Added

   Keywords||patch


--- Comment #3 from Dmitry Olshansky dmitry.o...@gmail.com 2011-07-06 
16:07:12 PDT ---
By the way here is the fix:
https://github.com/D-Programming-Language/phobos/pull/135

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


[Issue 6230] Member functions can no longer be weakly pure

2011-07-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6230


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-07-06 
20:34:27 PDT ---
https://github.com/D-Programming-Language/dmd/commit/47efdef731e2ed1333aeedc053d37adff4356585

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