[Issue 13685] std.numeric.arrayShape

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13685

--- Comment #1 from bearophile_h...@eml.cc ---
If arrayShape returns a specialized struct instead of a generic tuple, then
it's possible to add a method to the struct (otherwise a free function that
takes a tuple is acceptable using UFCS), like allocate, that allows to create
an array of given shape:

auto a1 = new int[][](10, 5);
auto s1 = a1.arrayShape;
auto a2 = s1.allocate!double; // 2D matrix of NaNs doubles.
assert(a1.arrayShape == a2.arrayShape);
auto a3 = s1.allocate!double(5.0); // Initialized to 5.0.
assert(a1.arrayShape == a3.arrayShape);
auto a4 = s1.allocate!double((r, c) = r * c); // Initialized to r*c.
assert(a1.arrayShape == a4.arrayShape);

--


[Issue 9842] std.algorithm.hashGroup / hashGroupBy

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=9842

--- Comment #2 from bearophile_h...@eml.cc ---
(In reply to hsteoh from comment #1)
 Isn't this just the same as data.hashSort.group? For hash sort to work, the
 key must map to an integral value and must be bounded by known min/max
 values.

The output and working is different. The hashGroupBy doesn't return a range of
pairs as the function group.

If you write:

auto names = [Sam, Samuel, Samu, Ravi, Ratna, Barsha];
auto grps = names.hashGroupBy!(n = n.length);

Now grps is:

assert(grps == [3:[Sam], 4:[Samu, Ravi], 5:[Ratna], 6:[Samuel,
Barsha]]);

The keys can be anything, not just integers in an interval.

--


[Issue 13688] New: 'in' expression for AA not detected as GC usage

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13688

  Issue ID: 13688
   Summary: 'in' expression for AA not detected as GC usage
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Keywords: accepts-invalid
  Severity: normal
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: sinkuup...@gmail.com

'in' expression for AA calls KeyType.toHash/opEquals if exist, but not detected
as GC usage even if these functions are not @nogc.

Example: (In this case, compiler should require that toHash/opEquals are
@nogc.)
struct KeyType
{
int x;

size_t toHash() const @safe nothrow
{
return x;
}

bool opEquals(in KeyType r) const
{
return x == r.x;
}
}

ulong func(ulong[KeyType] aa) @nogc
{
if (auto p = KeyType(10) in aa) // can call KeyType.toHash/opEquals
return *p;

return aa.length;
}

--


[Issue 13689] byCodeUnit is not sortable

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13689

bearophile_h...@eml.cc changed:

   What|Removed |Added

 CC||bearophile_h...@eml.cc

--- Comment #1 from bearophile_h...@eml.cc ---
This works:

void main() {
import std.algorithm: sort;
import std.string: representation;
char[] arr = ACBA.dup;
arr.representation.sort();
assert(arr == AABC);
}

--


[Issue 13689] byCodeUnit is not sortable

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13689

hst...@quickfur.ath.cx changed:

   What|Removed |Added

   Keywords||pull
 CC||hst...@quickfur.ath.cx

--- Comment #2 from hst...@quickfur.ath.cx ---
https://github.com/D-Programming-Language/phobos/pull/2656

--


[Issue 13689] byCodeUnit fails to be a random access range

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13689

hst...@quickfur.ath.cx changed:

   What|Removed |Added

Summary|byCodeUnit is not sortable  |byCodeUnit fails to be a
   ||random access range

--


[Issue 13689] byCodeUnit fails to be a random access range

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13689

hst...@quickfur.ath.cx changed:

   What|Removed |Added

   Severity|enhancement |normal

--


[Issue 13674] Internal error: backend/el.c 2882

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13674

hst...@quickfur.ath.cx changed:

   What|Removed |Added

   Keywords||ice
 CC||hst...@quickfur.ath.cx
   Severity|normal  |critical

--


[Issue 13671] http://dlang.org/const3.html incorrectly calls type qualifiers type constructors

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13671

hst...@quickfur.ath.cx changed:

   What|Removed |Added

 CC||hst...@quickfur.ath.cx

--


[Issue 13585] Assert in std.format unitests fails

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13585

hst...@quickfur.ath.cx changed:

   What|Removed |Added

 CC||hst...@quickfur.ath.cx

--


[Issue 13686] Reading unicode string with readf (%s) produces a wrong string

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13686

ag0ae...@gmail.com changed:

   What|Removed |Added

 CC||ag0ae...@gmail.com
  Component|DMD |Phobos
   Hardware|x86_64  |All
 OS|Windows |All
   Severity|enhancement |normal

--- Comment #4 from ag0ae...@gmail.com ---
Copying my comment from the forum thread:

std.stdio.LockingTextReader is to blame:

void main()
{
 import std.stdio;
 auto ltr = LockingTextReader(std.stdio.stdin);
 write(ltr);
}

$ echo Тест | rdmd test.d
ТеÑÑ

LockingTextReader has a dchar front. But it doesn't do any 
decoding. The dchar front is really a char front.

--


[Issue 13690] New: Curiously Recurring Template Pattern causes segfault.

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13690

  Issue ID: 13690
   Summary: Curiously Recurring Template Pattern causes segfault.
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: p...@pitt.edu

The following causes dmd to segfault:

import std.traits;

interface BarBase
{
void do_a_thing();
}

interface Bar(T) : BarBase
{
static if(hasMember!(T, rotation)  is(typeof(T.rotation) == 
double))
{
 @property
 double rotation();

final void do_a_thing()
{
//do a thing with rotation;
}
}
else
{
final void do_a_thing()
{
//do a thing without rotation;
}
}
}

class Foo1 : Bar!Foo1
{
}

class Foo2 : Bar!Foo2
{
@property
double rotation() { return 1.0; };
}

This code is theoretically compilable because if it were changed to imitate the
halting problem then: if the function is declared final then there isn't a
conflict, if it isn't then the class has to be abstract.

--


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

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6766

hst...@quickfur.ath.cx changed:

   What|Removed |Added

 CC||hst...@quickfur.ath.cx

--- Comment #1 from hst...@quickfur.ath.cx ---
Tested on git HEAD, the first case now works; the second case gives the error
message:

--
test.d(4): Error: no constructor for Foo
test.d(10): Error: cannot create a struct until its size is determined
--

So looks like the bug is partially fixed, but not quite there yet.

--


[Issue 6784] Compile-time constant assigned with a runtime value

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6784

hst...@quickfur.ath.cx changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||hst...@quickfur.ath.cx
 Resolution|--- |WORKSFORME

--- Comment #4 from hst...@quickfur.ath.cx ---
Tested on git HEAD, now the compiler correctly issues an error:

--
test.d(4): Error: value of 'this' is not known at compile time
--

The test code was modified to use size_t instead of uint, since on 64-bit
platforms args.length is ulong, and the compiler will complain that you can't
assign ulong to uint. But that's irrelevant to this bug.

--


[Issue 6762] Template parameter declaration does name lookup

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6762

hst...@quickfur.ath.cx changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||hst...@quickfur.ath.cx
 Resolution|--- |WORKSFORME

--- Comment #1 from hst...@quickfur.ath.cx ---
Tested on git HEAD, Linux/64. Can't reproduce problem anymore. I guess it has
been fixed since?

--


[Issue 6815] Char array is turned into string expression during constant folding

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6815

hst...@quickfur.ath.cx changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||hst...@quickfur.ath.cx
 Resolution|--- |WORKSFORME

--- Comment #3 from hst...@quickfur.ath.cx ---
Tested on git HEAD, Linux/64. Neither test case produces an error now. Looks
like the bug has been fixed.

--


[Issue 6784] Compile-time constant assigned with a runtime value

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6784

--- Comment #5 from yebblies yebbl...@gmail.com ---
Does it still exist in D1?

--


[Issue 13674] ICE(el.c) with simd multiplication of short8

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13674

yebblies yebbl...@gmail.com changed:

   What|Removed |Added

   Keywords||SIMD
 CC||yebbl...@gmail.com
Summary|Internal error: |ICE(el.c) with simd
   |backend/el.c 2882   |multiplication of short8

--


[Issue 6750] Explicit template instantiation with auto ref

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6750

hst...@quickfur.ath.cx changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||hst...@quickfur.ath.cx
 Resolution|--- |WORKSFORME

--- Comment #1 from hst...@quickfur.ath.cx ---
Tested on dmd git HEAD, Linux/64, the compiler now accepts this code (including
various variations as suggested in the comments). Looks like it's fixed since.
Please reopen the bug if the problem still occurs. Thanks!

--


[Issue 6745] template signature match failure (matrix transpose example)

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6745

hst...@quickfur.ath.cx changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||hst...@quickfur.ath.cx
 Resolution|--- |WORKSFORME

--- Comment #1 from hst...@quickfur.ath.cx ---
Tested on git HEAD, Linux/64. The compiler now accepts this code, looks like
it's been fixed since. Please reopen if it still happens. Thanks!

--


[Issue 6722] Can't remove a char[] key from an AA with immutable(char)[] key type.

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6722

hst...@quickfur.ath.cx changed:

   What|Removed |Added

 CC||hst...@quickfur.ath.cx

--


[Issue 6579] Calling static method should *require* using type and not instance, unless specified by author

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6579

hst...@quickfur.ath.cx changed:

   What|Removed |Added

 CC||hst...@quickfur.ath.cx

--


[Issue 5831] Template specialization ordering bug

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=5831

hst...@quickfur.ath.cx changed:

   What|Removed |Added

 CC||hst...@quickfur.ath.cx

--- Comment #1 from hst...@quickfur.ath.cx ---
Tested on git HEAD, Linux/64. Bug is still present.

--


[Issue 5770] Template constructor bypass access check

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=5770

hst...@quickfur.ath.cx changed:

   What|Removed |Added

 CC||hst...@quickfur.ath.cx

--- Comment #2 from hst...@quickfur.ath.cx ---
Tested on git HEAD, Linux/64. Bug still occurs.

--


[Issue 6784] Compile-time constant assigned with a runtime value

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6784

--- Comment #6 from hst...@quickfur.ath.cx ---
No idea, should the bug be reopened for D1-only?

--


[Issue 10256] Fix .deb file production

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10256

hst...@quickfur.ath.cx changed:

   What|Removed |Added

 CC||hst...@quickfur.ath.cx

--


[Issue 13691] New: Add @nogc at the top of system modules like core.sys.linux.sys.mman

2014-11-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13691

  Issue ID: 13691
   Summary: Add @nogc at the top of system modules like
core.sys.linux.sys.mman
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: trivial
  Priority: P1
 Component: druntime
  Assignee: nob...@puremagic.com
  Reporter: marco.le...@gmx.de

Trivial, but I thought I'd write it down as a formal bug report to be able to
refer to it in my code comments. There is Phobos @nogc code, which usually
means no heap activity and there is @nogc code that just manages memory
differently and often relies on system functions, which are not yet marked
@nogc.
E.g. I found that with madvise(..., MADV_DONTNEED) you can quickly reset memory
blocks to all-zeros and free up the resident memory pages again.

--