[Issue 5941] Using inner struct which references nested function in a no-attribute or auto-return member function causes "nested function cannot be accessed" error

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5941


Don  changed:

   What|Removed |Added

   Keywords||accepts-invalid


--- Comment #3 from Don  2011-12-21 23:30:26 PST ---
In bug 5939, Walter explicitly stated that the test case is comment 2 is not a
bug. However, the fact that it compiles if the function 'get' is removed, or if
attributes are added to get(), is surely a bug. Based on Walter's comment, it
should never compile. So I'm marking as accepts-invalid.

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


[Issue 4286] Wrong error line number and more with schwartzSort

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4286



--- Comment #1 from Don  2011-12-21 23:25:10 PST ---
The wrong line number was fixed in DMD2.054.
The other issue is an instance of bug 5939, bug 6217, and various others.

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


[Issue 7150] New: Templated Constructors Should be Able to Call Other Constructors

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7150

   Summary: Templated Constructors Should be Able to Call Other
Constructors
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: debio...@gmail.com


--- Comment #0 from Andrew Wiley  2011-12-21 23:18:00 PST 
---
Template constructors currently cannot call other constructors in an aggregate
type:

---
struct A {
   this(T)(T thing, int i) {
   this(thing, i > 0); // Error: constructor call must be in a constructor
   }
   this(T)(T thing, bool b) {
   }
}

void main() {
   auto a = A(5, 5); // Error: template instance
constructtest.A.__ctor!(int) error instantiating
}
---

Template constructors should follow the same rules for
constructors-calling-constructors as normal non-template constructors.

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


Re: std.conv.emplace

2011-12-21 Thread Jonathan M Davis
On Thursday, December 22, 2011 07:23:14 Froglegs wrote:
> This function
> 
> T emplace(T, Args...)(void[] chunk, Args args) if (is(T == class))
> {
> enforce(chunk.length >= __traits(classInstanceSize, T),
>new ConvException("emplace: chunk size too small
> 
> 
> This >= needs to be changed to a <

Please, do not post to this list (it really should reject all posts sent to it 
by users). You sign up for it if you want to see all of the messages sent by 
bugzilla, _not_ to post bugs. Bugs should be posted to bugzilla:

d.puremagic.com/issues

- Jonathan M Davis


std.conv.emplace

2011-12-21 Thread Froglegs



This function

T emplace(T, Args...)(void[] chunk, Args args) if (is(T == class))
{
   enforce(chunk.length >= __traits(classInstanceSize, T),
  new ConvException("emplace: chunk size too small


This >= needs to be changed to a <





[Issue 7149] New: Segfault on Array Append from Multiple Threads in GDC and LDC: Race Condition?

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7149

   Summary: Segfault on Array Append from Multiple Threads in GDC
and LDC:  Race Condition?
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: critical
  Priority: P2
 Component: druntime
AssignedTo: nob...@puremagic.com
ReportedBy: dsim...@yahoo.com


--- Comment #0 from David Simcha  2011-12-21 20:49:31 PST ---
import core.thread;

void main() {
auto t = new Thread(&doIt);
t.start();
doIt();
}

void doIt() {
while(1) {
int[] arr1, arr2;
double[] arr3;

foreach(i; 0..10_000) {
arr1 ~= 1;
arr2 ~= 2;
arr3 ~= 3;
}
}
}

This code segfaults on both GDC
(https://bitbucket.org/goshawk/gdc/issue/295/null-pointer-deref-in-_d_arrayappendctp)
and LDC (https://github.com/ldc-developers/ldc/issues/56).  It works on DMD or
of doIt() is only called from one thread.  

Since this is broken on both GDC and LDC it's worth having a bug report in the
main druntime database.  My gut feeling is that there's a concurrency bug
that's triggered by some compiler optimization that GDC and LDC do but DMD
doesn't do.

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


[Issue 6690] Using lazy parameter should be inferred as @safe

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6690


Kenji Hara  changed:

   What|Removed |Added

 CC||kenn...@gmail.com


--- Comment #3 from Kenji Hara  2011-12-21 19:31:25 PST ---
*** Issue 6328 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 6328] Functions using lazy argument cannot be inferred as @safe

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6328


Kenji Hara  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||DUPLICATE


--- Comment #1 from Kenji Hara  2011-12-21 19:31:25 PST ---
*** This issue has been marked as a duplicate of issue 6690 ***

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


[Issue 7143] [CTFE] cannot compare class references with "is"

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7143


Walter Bright  changed:

   What|Removed |Added

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


--- Comment #1 from Walter Bright  2011-12-21 
15:24:10 PST ---
https://github.com/D-Programming-Language/dmd/commit/767708299a408b4a234ee9ad4f45b0e6e0c21e6d

https://github.com/D-Programming-Language/dmd/commit/13195c39ae3e3788c559d8e88d3203371e43f029

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


[Issue 6984] CTFE generates a torrent of spurious errors, if there was a previous error

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6984


Walter Bright  changed:

   What|Removed |Added

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


--- Comment #1 from Walter Bright  2011-12-21 
15:24:29 PST ---
https://github.com/D-Programming-Language/dmd/commit/767708299a408b4a234ee9ad4f45b0e6e0c21e6d

https://github.com/D-Programming-Language/dmd/commit/13195c39ae3e3788c559d8e88d3203371e43f029

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


[Issue 7144] [CTFE] base class does not call overridden members

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7144


Walter Bright  changed:

   What|Removed |Added

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


--- Comment #1 from Walter Bright  2011-12-21 
15:20:47 PST ---
https://github.com/D-Programming-Language/dmd/commit/767708299a408b4a234ee9ad4f45b0e6e0c21e6d

https://github.com/D-Programming-Language/dmd/commit/13195c39ae3e3788c559d8e88d3203371e43f029

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


[Issue 5941] Using inner struct which references nested function in a no-attribute or auto-return member function causes "nested function cannot be accessed" error

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5941


Don  changed:

   What|Removed |Added

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


--- Comment #2 from Don  2011-12-21 14:35:39 PST ---
Reduced test case suggests it's related to typeof():

auto fx() {
struct S {
void get() {}
}
return S.init;
}
void main() {
//auto w = fx(); // OK
typeof(fx()) z;  // fails!
}

Again, adding any attributes to get() removes the bug -- even though get() is
never used.

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


[Issue 7129] Compiling certain nested structs with -inline causes error "*** is a nested function and cannot be accessed from ***"

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7129


Don  changed:

   What|Removed |Added

 CC||clugd...@yahoo.com.au
   Severity|regression  |normal


--- Comment #3 from Don  2011-12-21 14:36:24 PST ---
This isn't a regression. The reduced test case behaved the same in 2.026, which
was the first version that could compile 'auto' functions.

This is probably a duplicate of bug 4724 (which involves -inline).
Could also be a dup of bug 4286 or bug 4841 (which involves -inline, but uses
delegates and alias templates)
Bug 5941 seems to be simplest test case for this species of bug.

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


[Issue 5809] feqrel fails assert in std.math on x86_64 systems

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5809


Don  changed:

   What|Removed |Added

   Keywords||wrong-code
 CC||clugd...@yahoo.com.au


--- Comment #3 from Don  2011-12-21 13:02:13 PST ---
This sounds like a compiler bug. Does it still fail on 2.057?

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


[Issue 7148] New: Turn associative array byValue/byKey/byPairs into ranges

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7148

   Summary: Turn associative array byValue/byKey/byPairs into
ranges
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: druntime
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2011-12-21 10:36:46 PST ---
Please, turn associativeArray.byValue(), associativeArray.byKey(),
associativeArray.byPairs() into Ranges. This allows this code to work:


import std.range;
void main() {
auto aa = [1:["hello", "red"], 2:["blue", "yellow"]];
auto r2 = join(aa.byValue()); // error
}

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


[Issue 4468] std.string.join() for lazy iterable of strings

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4468


bearophile_h...@eml.cc changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


--- Comment #3 from bearophile_h...@eml.cc 2011-12-21 10:33:37 PST ---
Now in DMD 2.057 this works:

import std.stdio, std.algorithm, std.conv, std.range, std.string;
void main() {
auto r = map!("to!string(a)")(iota(20));
//string result = join(array(r), ""); // OK
string result = join(r, ""); // error
writeln(result);
}


This line:
auto r = map!("to!string(a)")(iota(20));
is also better written:
auto r = map!text(iota(20));


But this doesn't work still:

import std.range;
void main() {
auto aa = [1:["hello", "red"], 2:["blue", "yellow"]];
auto r2 = join(aa.byValue()); // error
}


To make this work there are two solutions:
1) Change byValue() to return a Range.
2) Change join() to accept an opApply too.

The first solution allows to use byValue in many other cases, so I think join()
is OK, and I close this bug report.

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


[Issue 6356] Pure/nothrow/@safe-inference failed for a template function if it is instantiated without evaluating at the global scope

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6356


Kenji Hara  changed:

   What|Removed |Added

   Keywords||patch


--- Comment #2 from Kenji Hara  2011-12-21 07:59:54 PST ---
https://github.com/D-Programming-Language/dmd/pull/544

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


[Issue 6332] Auto-return function cannot be inferred as @safe

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6332


Kenji Hara  changed:

   What|Removed |Added

   Keywords||patch


--- Comment #1 from Kenji Hara  2011-12-21 07:58:29 PST ---
https://github.com/D-Programming-Language/dmd/pull/544

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


[Issue 4413] typeof(this) doesn't work in method template signature

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4413


Kenji Hara  changed:

   What|Removed |Added

   Keywords||rejects-valid
   Platform|x86 |All
 OS/Version|Windows |All


--- Comment #6 from Kenji Hara  2011-12-21 05:55:58 PST ---
https://github.com/D-Programming-Language/dmd/pull/572

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


[Issue 4413] typeof(this) doesn't work in method template signature

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4413



--- Comment #5 from Kenji Hara  2011-12-21 05:55:25 PST ---
*** Issue 5801 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 5801] Using typeof() in function header breaks ITFI and default template arguments.

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5801


Kenji Hara  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||DUPLICATE


--- Comment #3 from Kenji Hara  2011-12-21 05:55:25 PST ---
*** This issue has been marked as a duplicate of issue 4413 ***

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


[Issue 7147] [CTFE] typeid() should be supported in CTFE

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7147


Don  changed:

   What|Removed |Added

   Keywords||rejects-valid
   Severity|normal  |enhancement


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


[Issue 7147] New: [CTFE] typeid() should be supported in CTFE

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7147

   Summary: [CTFE] typeid() should be supported in CTFE
   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  2011-12-21 05:38:27 PST ---
static assert({
TypeInfo xxx = typeid(Object);
TypeInfo yyy = typeid(new Error("xxx"));
return true;
}());

The first typeid gives:
bug.d(7): Error: Cannot interpret & D17TypeInfo_C6Object6__initZ at compile
time

The second one gives:

bug.d(38): Error: dereference of invalid pointer
'Error("xxx",null,0u,null,null,null)'

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


[Issue 7111] New regex engine cannot match beginning of empty string

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7111


Nils  changed:

   What|Removed |Added

 CC||mailm...@nilsb.dyndns.org


--- Comment #1 from Nils  2011-12-21 01:39:08 PST ---
Seems to be an issue of ThompsonMatcher.
---
assert(!bmatch("", regex("^")).empty); // passes
---

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


[Issue 7146] New: enhance strip* (implementation provided)

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7146

   Summary: enhance strip* (implementation provided)
   Product: D
   Version: D2
  Platform: Other
OS/Version: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: pomp...@gmail.com


--- Comment #0 from pomp...@gmail.com 2011-12-21 00:50:17 PST ---
In some languages (e.g. python), the string "strip" function family accepts an
optional parameter which specifies the set of characters one wants to strip. If
not given, this is "whitespace". I think this is very useful and the D strip
should support that too.

For example, I needed it when getting a char buffer filled by a C function and
converting it to a string. Here is the implementation of these including
unittests that you can just drop into the string.d file if you remove the
import line. I would very much like to see this included in phobos - no
copyright/whatever needed.




// Remove when integrating into std.string.
import std.range, std.string, std.traits, std.utf;

/++
Strips leading characters.
  +/
S stripLeft(S)(S s, S charsToStrip) pure
if(isSomeString!S)
{
bool foundIt;
size_t notInSet;
foreach(i, dchar c; s)
{
// Because of the call to indexOf, this function can't be @safe
anymore.
if(indexOf(charsToStrip, c) == -1)
{
foundIt = true;
notInSet = i;
break;
}
}

if(foundIt)
return s[notInSet .. $];

return s[0 .. 0]; //Empty string with correct type.
}

unittest {
debug(string) printf("string.stripLeft2.unittest\n");

string hi = "Hello, world!";
assert(hi.stripLeft("") == hi);
assert(hi.stripLeft("H") == "ello, world!");
assert(hi.stripLeft("Hel") == "o, world!");
assert(hi.stripLeft("def") == hi);
assert(hi.stripLeft(hi) == "");
}

/++
Strips trailing characters.
  +/
S stripRight(S)(S s, S charsToStrip)
if(isSomeString!S)
{
alias typeof(s[0]) C;
size_t codeLen;
foreach(dchar c; retro(s))
{
// Because of the call to indexOf, this function can't be @safe
anymore.
if(indexOf(charsToStrip, c) >= 0)
codeLen += codeLength!C(c);
else
break;
}

return s[0 .. $ - codeLen];
}

unittest {
debug(string) printf("string.stripRight2.unittest\n");

string hi = "Hello, worldd!";
assert(hi.stripRight("") == hi);
assert(hi.stripRight("!") == "Hello, worldd");
assert(hi.stripRight("!.d") == "Hello, worl");
assert(hi.stripRight("hex") == hi);
assert(hi.stripRight(hi) == "");
}

/++
Strips both leading and trailing characters.
  +/
S strip(S)(S s, S charsToStrip)
if(isSomeString!S)
{
return stripRight(stripLeft(s, charsToStrip), charsToStrip);
}

unittest {
debug(string) printf("string.strip2.unittest\n");

string hi = " ohfoo";
assert(hi.strip("") == hi);
assert(hi.strip(" ") == "ohfoo");
assert(hi.strip(" o") == "hf");
assert(hi.strip("ext") == hi);
assert(hi.strip(" ohf") == "");
}

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


[Issue 6383] Unpacking from dynamic array, lazy ranges

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6383


pomp...@gmail.com changed:

   What|Removed |Added

 CC||pomp...@gmail.com


--- Comment #5 from pomp...@gmail.com 2011-12-21 00:38:37 PST ---
I think this would be very useful.(In reply to comment #2)
> (In reply to comment #1)
> > Sorry, this is not correct:
> > 
> > auto (start,end) = array(match(r, r"^(-?\d+)(-?(-?\d+))?$").captures);
> > auto (start,end) = match(r, r"^(-?\d+)(-?(-?\d+))?$").captures;
> 
> I'm puzzled, in this case captures contain way more then 2 strings:
> 0 - whole match
> 1 - (-?\d+)
> 2 - (-?(-?\d+))?
> 3 - (-?\d+)

So why couldn't "start" and "end" unpack the whole match and (-?\d+) and ignore
the last two?

I totally want to see unpacking in D2.

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