[Issue 2962] ICE(glue.c) or bad codegen passing variable as template value parameter

2012-03-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2962



--- Comment #38 from Don clugd...@yahoo.com.au 2012-03-23 01:48:04 PDT ---
(In reply to comment #36)
 cat  a.d  CODE
 import b;
 alias foo!() fooi;
 CODE
 
 cat  b.d  CODE
 void foo()(int p)
 {
 int inner()() { return p; }
 alias inner!() finner;
 }
 CODE
 
 dmd -c b a
 
 
 
 Slightly more reduced test case.
 
 There are two things that should get fixed.
 
 - We push template instances into the wrong object/module.
   The module a template instance is attached to is found
   by following the importedFrom chain. The head of the chain
   should be the template declaration module not the instantiation
   module. By doing so we guarantee that all instances remain
   ordered and are bundled with their dependencies.

It's interesting how closely related that issue is to this one I posted
yesterday:
https://github.com/D-Programming-Language/dmd/pull/824
Fundamentally we need to sort out which module owns a function. I'm not sure
where the code belongs.

 
 - VarDeclaration::toSymbol creates csym lazily.
   I don't see any reason why this shouldn't apply to
   parameters as well, e.g. replacing the 'p' parameter
   with a local variable fixes the bug. So we should
   just call v-toSymbol() and remove the assertion.

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


[Issue 7753] Support opIndexCreate as part of index operator overloading in user-defined types

2012-03-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7753


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

   What|Removed |Added

 CC||dmitry.o...@gmail.com


--- Comment #1 from Dmitry Olshansky dmitry.o...@gmail.com 2012-03-23 
03:28:52 PDT ---
It might be a good thing, but ...
Why not just return a proxy type upon each indexing?
The proxy type will have createIndex that will forward to others in turn.

Here a prof of concept I belive it could be generalized and polished.
For simplicity sake it's for n-dim arrays:

import std.stdio, std.exception;

struct Proxy(T)
{
T* _this;
int idx;
void opAssign(X)(X value){
debug writeln(Proxy.opAssign); 
createIndex(idx) = value;
}
static if(typeof(*_this).dimension = 2)
{

// somewhere io expression ...a[idx][jdx]... is create all, except last
one
auto opIndex(int jdx){
return proxy(_this.createIndex(idx), jdx);
}
//a[idx][jdx] = y; is create if non-existent
auto opIndexAssign(X)(X val, int jdx){  //TODO: constraints!
debug writeln(Proxy.opIndexAssign);
_this.createIndex(idx).createIndex(jdx) = val;
}
}

@property ref expr(){
debug writeln(Proxy.expr); 
return _this.normalIndex(idx);
}

alias expr this;
}

auto proxy(T)(T* x, int idx){ return Proxy!(T)(x,idx); }



struct M(size_t dim)
{
static if(dim == 1){
alias int Val;
}
else{
alias M!(dim-1) Val;
}
enum dimension = dim;


Val[] arr;


ref createIndex(int idx){
debug writeln(Created , typeof(this).stringof);
if(arr.length  idx)
arr.length = idx+1;
return arr[idx];
}
ref normalIndex(int idx){
debug writeln(Indexed , typeof(this).stringof);
return arr[idx];
}
auto opIndex(int idx){
return Proxy!(M)(this, idx);
}
alias arr this;
}

unittest{
M!(3) d3arr;
d3arr[1][2] = [2, 3, 4];
assert(d3arr[1][2][2] == 4);
int[] x = d3arr[1][2];  
assert(d3arr[1][2].length == 3); 
assert(d3arr[1][1] == null); //inited 
//booom used before explicit = 
assert(collectException!Error(d3arr[2][2][1] + 1 == 1) !is null);
}

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


[Issue 1772] regexp.split behavior with captures needs to be documented

2012-03-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1772


yebblies yebbl...@gmail.com changed:

   What|Removed |Added

 CC||yebbl...@gmail.com


--- Comment #6 from yebblies yebbl...@gmail.com 2012-03-23 22:14:18 EST ---
Is this fixed/D1 only now?

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


[Issue 5689] [64-Bit] uniform() fails with -profile

2012-03-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5689


d...@dawgfoto.de changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


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


[Issue 4337] Associative array assignment with dstring keys breaks lookup

2012-03-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4337


yebblies yebbl...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||DUPLICATE


--- Comment #6 from yebblies yebbl...@gmail.com 2012-03-23 22:40:54 EST ---
*** This issue has been marked as a duplicate of issue 7512 ***

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


[Issue 7512] Associative arrays implementation loses const and immutable in AA.get() and AA[key]

2012-03-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7512


yebblies yebbl...@gmail.com changed:

   What|Removed |Added

 CC||Justin.SpahrSummers@gmail.c
   ||om


--- Comment #10 from yebblies yebbl...@gmail.com 2012-03-23 22:40:54 EST ---
*** Issue 4337 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 1772] regexp.split behavior with captures needs to be documented

2012-03-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1772


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

   What|Removed |Added

Version|1.025   |D1


--- Comment #7 from Dmitry Olshansky dmitry.o...@gmail.com 2012-03-23 
05:17:17 PDT ---
I'm no expert D1 stuff, but I belive issue is still applicable for D1.
Come to think of, I closed few D1 issues like this in the past, maybe we should
close this one too (marked as D1 for now).
D1/D2 regexp is broken in many ways and nobody is doing any work on Phobos/D1
to fix it AFIAK, Tango folks have their own regex anyway.

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


[Issue 6659] Destructor in range foreach called after initialization

2012-03-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6659


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

   What|Removed |Added

   Keywords||wrong-code
   Platform|Other   |All
 OS/Version|FreeBSD |All
   Severity|normal  |major


--- Comment #1 from Kenji Hara k.hara...@gmail.com 2012-03-23 05:52:32 PDT ---
A foreach range statement:

foreach (iter; lower .. upper) {}

is always translated to a for statement:

for (auto iter = lower, limit = upper; iter != upper; ++iter) {}

So, this is a lifetime issue declared in for statement Initialize part.

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


[Issue 6659] Destructor in range foreach called after initialization

2012-03-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6659


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

   What|Removed |Added

   Keywords||pull


--- Comment #2 from Kenji Hara k.hara...@gmail.com 2012-03-23 06:04:47 PDT ---
https://github.com/D-Programming-Language/dmd/pull/826

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


[Issue 1772] (D1 only) regexp.split behavior with captures needs to be documented

2012-03-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1772


yebblies yebbl...@gmail.com changed:

   What|Removed |Added

 Status|ASSIGNED|NEW
   Platform|x86 |All
 AssignedTo|dmitry.o...@gmail.com   |nob...@puremagic.com
Summary|regexp.split behavior with  |(D1 only) regexp.split
   |captures needs to be|behavior with captures
   |documented  |needs to be documented
 OS/Version|Windows |All


--- Comment #8 from yebblies yebbl...@gmail.com 2012-03-24 01:06:04 EST ---
I guess it can be closed when D1 is discontinued at the end of the year.

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


[Issue 7753] Support opIndexCreate as part of index operator overloading in user-defined types

2012-03-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7753



--- Comment #2 from hst...@quickfur.ath.cx 2012-03-23 07:36:46 PDT ---
That's a pretty neat idea. Can it be made to work with containers that contain
other containers (possibly of a different type)? E.g., a linked list of arrays
of AA's?

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


[Issue 7753] Support opIndexCreate as part of index operator overloading in user-defined types

2012-03-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7753



--- Comment #3 from Dmitry Olshansky dmitry.o...@gmail.com 2012-03-23 
08:17:58 PDT ---
Well, linked list is, for sure, not indexed so not a problem ;)
As for sets I don't see a problem, I can extend this idea to arbitrary set
easily. In fact it's even cleaner for sets (maps) then arrays.
If you need a headstart I can scratch up a simple version for integer sets.

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


[Issue 7753] Support opIndexCreate as part of index operator overloading in user-defined types

2012-03-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7753



--- Comment #4 from Dmitry Olshansky dmitry.o...@gmail.com 2012-03-23 
08:22:00 PDT ---
Ahm. So Q was about geterogenious stuff like arrays of sets(maps) or maps of
arrays ? 
I think the 2 mentioned situations cover it all, thus you can parametrize this
idea on basis of:
a) contigous container, to get item with index X you need to allocted all
elements up X. Here X is obviously can be only integer of some sort.
b)non-contigous container, to get item with index X you check/create only slot
indexed by X.

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


[Issue 7754] New: static this() in template is stripped during header gen

2012-03-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7754

   Summary: static this() in template is stripped during header
gen
   Product: D
   Version: D2
  Platform: All
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 2012-03-23 09:29:21 PDT ---
cat  bug.d  CODE
struct Foo(T)
{
shared static this()
{
}

static this()
{
}
}
CODE

dmd -c -o- -H bug.d
cat bug.di

// D import file generated from 'bug.d'
template Foo(T)
{
struct Foo
{
shared static this();
static this();
}
}



Thus the static constructors are not run.

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


[Issue 7755] New: regression(2.059head): ICE in glue.c

2012-03-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7755

   Summary: regression(2.059head): ICE in glue.c
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Keywords: ice
  Severity: regression
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: timon.g...@gmx.ch


--- Comment #0 from timon.g...@gmx.ch 2012-03-23 12:23:56 PDT ---
The following code causes an ICE in DMD 2.059head. It compiles with DMD 2.058.

---
import std.conv: to;

template Foo(T){}
struct Bar{
void qux(){
if(is(typeof(to!string(Foo!int{};
}
}
---

dmd: glue.c:1114: virtual unsigned int Type::totym(): Assertion `0' failed.
Aborted

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


[Issue 4703] Ambiguously designed array syntax

2012-03-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4703



--- Comment #10 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-03-23 
15:54:17 PDT ---
I think this bug is the cause of bug 6469. Discussed in
http://forum.dlang.org/thread/CAJ85NXDh47+0fNrykjRh04KfRCSjC=nsnzr8agd2p3zf2ae...@mail.gmail.com#post-jkhg1u:242ou2:241:40digitalmars.com

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


[Issue 4703] Ambiguously designed array syntax

2012-03-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4703



--- Comment #11 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-03-23 
15:54:41 PDT ---
(In reply to comment #10)
 I think this bug
s/bug/syntax issue

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


[Issue 7757] New: Inout function with lazy inout parameter doesn't compile

2012-03-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7757

   Summary: Inout function with lazy inout parameter doesn't
compile
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: critical
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: hst...@quickfur.ath.cx


--- Comment #0 from hst...@quickfur.ath.cx 2012-03-23 19:04:06 PDT ---
Code:

inout(int) func(int x, lazy inout(int) defaultVal) {
return defaultVal;
}

void main() {
int x = func(1,2);
const(int) cx = func(1,2);
}

Compiler error:

test2.d(4): Error: inout on return means inout must be on a parameter as well
for pure @safe inout(int)()
test2.d(8): Error: inout on return means inout must be on a parameter as well
for inout(int)()
test2.d(9): Error: inout on return means inout must be on a parameter as well
for inout(int)()

Clearly, this is wrong, because inout *is* on the second parameter. It's being
masked by the lazy, as can be proven by removing lazy and it will compile.

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


[Issue 7758] New: Mixin error: No size yet for forward reference

2012-03-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7758

   Summary: Mixin error: No size yet for forward reference
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: andrej.mitrov...@gmail.com


--- Comment #0 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-03-23 
21:06:20 PDT ---
string Test(alias member)() 
{
return ;
}

struct S 
{ 
int i; 
mixin(Test!i());
}

void main() { }

test.d(9): Error: struct test.S no size yet for forward reference
test.d(10):called from here: Test()
test.d(10): Error: argument to mixin must be a string, not (Test())

If I use a mixin template instead it can work:

mixin template Test(alias member)
{
typeof(member) x;
}

struct S 
{ 
int i; 
mixin Test!i;
}

void main() { }

And yet if I try to use mixin() inside of a mixin template it doesn't work:

string test(alias member)() { return ; }
mixin template Test(alias member)
{
mixin(test!member());
}

struct S 
{ 
int i; 
mixin Test!i;
}

void main() { }

test.d(10): Error: struct test.S no size yet for forward reference
test.d(6):called from here: test()
test.d(6): Error: argument to mixin must be a string, not (test())
test.d(12): Error: mixin test.S.Test!(i) error instantiating

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


[Issue 7694] Internal error: e2ir.c 1251 when calling member function inside struct via alias param

2012-03-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7694


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

   What|Removed |Added

   Keywords||pull


--- Comment #2 from Kenji Hara k.hara...@gmail.com 2012-03-23 22:38:49 PDT ---
https://github.com/D-Programming-Language/dmd/pull/827

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


[Issue 7694] Internal error: e2ir.c 1251 when calling member function inside struct via alias param

2012-03-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7694



--- Comment #3 from Kenji Hara k.hara...@gmail.com 2012-03-23 22:50:19 PDT ---
(In reply to comment #0)
 As is the following gives assert on line 8 as expected, 
 uncomment bootstrap to get Internal error: e2ir.c 1251
 
 template Instruction(int ir)
 {
 void match(alias s, alias  m)(){ m.nextState(); }
 }
 
 
 struct T{
 void nextState(){  assert(0); }
 /*void bootstrap()
 {
 return Instruction!(0).match!(this, this)();
 }*/
 }
 
 T t;
 void main()
 {
 
 //  t.bootstrap();
   Instruction!(0).match!(t, t)();
 }

With my pull, this code doesn't report ice, but raises following errors:

test.d(11): Error: template instance match!(this,this) cannot use local 'this'
as parameter to non-global template match(alias s,alias m)
test.d(11): Error: template instance match!(this,this) cannot use local 'this'
as parameter to non-global template match(alias s,alias m)

But I think this is a little harsh error. The nested template (function) match
in module template Instruction really needs only one context, that is enclosing
'this' given as alias parameters m and n.

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