[Issue 6935] New: struct with @disable this cannot make range

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

   Summary: struct with @disable this cannot make range
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Keywords: rejects-valid
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: k.hara...@gmail.com


--- Comment #0 from Kenji Hara k.hara...@gmail.com 2011-11-12 01:11:57 PST ---
Following code should compile, but doesn't.

import std.range;
struct R
{
@disable this();  // requires explicit initializer

@property bool empty() const{ return false; }
@property int front(){ return 0; }
void popFront(){}

@property R save(){ return this; }

int back(){ return 0; }
void popBack(){}

int opIndex(size_t n){ return 0; }
@property size_t length() const { return 0; }
}
static assert(isInputRange!R);
static assert(isForwardRange!R);
static assert(isBidirectionalRange!R);
static assert(isRandomAccessRange!R);

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


[Issue 6935] struct with @disable this cannot make range

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


Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

   Keywords||patch


--- Comment #1 from Kenji Hara k.hara...@gmail.com 2011-11-12 01:28:41 PST ---
https://github.com/D-Programming-Language/phobos/pull/324

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


[Issue 6936] New: type combination is not commutative

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

   Summary: type combination is not commutative
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: timon.g...@gmx.ch


--- Comment #0 from timon.g...@gmx.ch 2011-11-12 04:06:19 PST ---
Tested with DMD 2.056.

const(int[]) x;
const(int)[] y;

static assert(is(typeof(1?x:y) == typeof(1?y:x))); // fail.


Error: static assert  (is(const(int)[] == const(int[]))) is false

The static assertion should pass.

I suggest the common type in this case should be const(int)[]. That is
consistent with how type combination works for basic types.

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


[Issue 6928] alias this, immutable and common type fail in presence of fields with indirections

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


Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

   Keywords||patch


--- Comment #1 from Kenji Hara k.hara...@gmail.com 2011-11-12 06:18:47 PST ---
https://github.com/D-Programming-Language/dmd/pull/466

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


[Issue 6924] An alias this problem to implement a Typedef

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


Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||DUPLICATE


--- Comment #1 from Kenji Hara k.hara...@gmail.com 2011-11-12 06:56:29 PST ---
I think this is a same issue with bug 6174.

The assignment expression

  a3b = [1, 2, 3];

is translated to

  a3b.data = [1, 2, 3];

, and current dmd does not allow indirect initialization of members with
assignment.

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

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


[Issue 6174] Initialize const fixed-size array in constructor

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



--- Comment #4 from Kenji Hara k.hara...@gmail.com 2011-11-12 06:56:29 PST ---
*** Issue 6924 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 6929] [ICE] typeMerge crashes in presence of ambiguous alias this conversions

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



--- Comment #1 from Kenji Hara k.hara...@gmail.com 2011-11-12 07:08:04 PST ---
In this case, S and T don't have common type.

With the expression (1? t:s), two expansions of alias this exist.
One of them is
   1? t.get():s,  type == S
Other is 
   1? t:s.get(),  type == T

This ambiguate should cause error.

But, ICE is bad. It should be fixed.

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


[Issue 6929] [ICE] typeMerge crashes in presence of ambiguous alias this conversions

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


Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

   Keywords||patch
   Platform|Other   |All
 OS/Version|Linux   |All


--- Comment #2 from Kenji Hara k.hara...@gmail.com 2011-11-12 07:12:19 PST ---
https://github.com/D-Programming-Language/dmd/pull/466

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


[Issue 6910] __traits(hasMember, name) does not work, if template has alias param

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


Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

   Keywords||patch, wrong-code
   Platform|x86_64  |All
Version|D2  |D1  D2
 OS/Version|Linux   |All


--- Comment #1 from Kenji Hara k.hara...@gmail.com 2011-11-12 08:43:48 PST ---
I think this is an issue that both of D1 and D2 have.

D2 patch:
https://github.com/D-Programming-Language/dmd/pull/509

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


[Issue 6937] New: new with struct doesn't allow field assignment

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

   Summary: new with struct doesn't allow field assignment
   Product: D
   Version: D2
  Platform: Other
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: d...@dawgfoto.de


--- Comment #0 from d...@dawgfoto.de 2011-11-12 08:44:16 PST ---
struct
{
  int a;
}

auto s1 = S(2); // works
auto s2 = new S(2); // doesn't work

--

New with struct strictly requires a defined constructor while
it should have the same construction rules as a normal struct literal.

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


[Issue 6632] toUTFz sometimes does not work with const parameters

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



--- Comment #6 from Jonathan M Davis jmdavisp...@gmx.com 2011-11-12 11:00:47 
PST ---
By the way, in case you didn't notice, I should point out that thanks to the
discussion on the newsgroup about it, toUTF16z is no longer scheduled for
deprecation. It's still using its old implementation internally, but should be
switched over to using toUTFz by the next release (which will allow it to take
all of the string types). So, if your use case of toUTFz matches toUTF16z, then
you can use that.

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


[Issue 6632] toUTFz sometimes does not work with const parameters

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



--- Comment #7 from Andrej Mitrovic andrej.mitrov...@gmail.com 2011-11-12 
11:24:01 PST ---
Ok good to know, this will help porting older code. Thanks.

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


[Issue 6939] shared pointers are type combined incorrectly

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



--- Comment #1 from timon.g...@gmx.ch 2011-11-12 11:50:15 PST ---
Oops.

Obviously x and z should not have a common type at all.
So the third static assertion should not pass. (it currently fails for the
wrong reason though).

Replace the test with this:

sharedint* x;
immutable int* y;
const int* z;

static assert(is(typeof(1?x:y)  == shared(const(int))*));  // fail
static assert(!is(typeof(1?x:y) == const(int)*));  // fail
static assert(!is(typeof(1?x:z))); // fail

sharedint[] a;
immutable int[] b;
const int[] c;

static assert(is(typeof(1?a:b)  == shared(const(int))[])); // pass (ok)
static assert(!is(typeof(1?a:b) == const(int)[])); // pass (ok)
static assert(!is(typeof(1?x:z))); // fail

All of these should pass.

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


[Issue 6939] wrong type qualifier combination

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


timon.g...@gmx.ch changed:

   What|Removed |Added

   Keywords||accepts-invalid,
   ||rejects-valid
Summary|shared pointers are type|wrong type qualifier
   |combined incorrectly|combination


--- Comment #2 from timon.g...@gmx.ch 2011-11-12 11:54:47 PST ---
...

static assert(!is(typeof(1?a:c))); // fail

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


[Issue 6939] wrong type qualifier combination

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



--- Comment #3 from timon.g...@gmx.ch 2011-11-12 12:02:03 PST ---
inout is buggy too: inout and shared are combined to shared const.

inout(int[]) foo(inout int[] x, shared int[] y, inout int* a, shared int* b){
static assert(!is(typeof(1?x:y))); // fail
static assert(!is(typeof(1?a:b))); // fail
return x;
}

Both assertions should pass.

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


[Issue 6940] New: immutable(int*)* and int** do not combine

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

   Summary: immutable(int*)* and int** do not combine
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: timon.g...@gmx.ch


--- Comment #0 from timon.g...@gmx.ch 2011-11-12 13:34:54 PST ---
immutable(int*)* and int** do not combine even though const(int*)* would be a
common type:

immutable(int*)*x;
int**   y;

static assert(is(typeof(x) : const(int*)*)); // ok
static assert(is(typeof(y) : const(int*)*)); // ok
static assert(is(typeof(1?x:y)));// fail


Compare to dynamic arrays:

immutable(int[])[]  a;
int[][] b;

static assert(is(typeof(a) : const(int[])[])); // ok
static assert(is(typeof(b) : const(int[])[])); // ok
static assert(is(typeof(1?a:b)));  // ok

(why on earth do the two cases use different logic?)

Therefore the following could be used as a workaround:

static assert(is(typeof((1?x[0..1]:y[0..1]).ptr)));

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


[Issue 6941] New: .stringof displays redundant storage classes

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

   Summary: .stringof displays redundant storage classes
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: timon.g...@gmx.ch


--- Comment #0 from timon.g...@gmx.ch 2011-11-12 14:51:47 PST ---
static assert((const(shared(int[])[])).stringof == const(shared(int[])[]));
// fail
static assert((const(shared(int[])[])).stringof !=
const(shared(const(int[]))[])); // fail

I think those two assertions should pass.

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