[Issue 7810] [CTFE] Typesafe variadic function with array of structs

2015-06-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7810

Andrei Alexandrescu and...@erdani.com changed:

   What|Removed |Added

Version|D1  D2 |D2

--


[Issue 7810] [CTFE] Typesafe variadic function with array of structs

2012-12-12 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7810


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

   What|Removed |Added

 CC||iteronve...@gmail.com


--- Comment #15 from Don clugd...@yahoo.com.au 2012-12-12 04:54:33 PST ---
*** Issue 8805 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 7810] [CTFE] Typesafe variadic function with array of structs

2012-11-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7810


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

   What|Removed |Added

 CC||v...@markovic.io


--- Comment #14 from Dmitry Olshansky dmitry.o...@gmail.com 2012-11-30 
12:49:43 PST ---
*** Issue 8725 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 7810] [CTFE] Typesafe variadic function with array of structs

2012-10-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7810


Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

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


--- Comment #13 from Walter Bright bugzi...@digitalmars.com 2012-10-16 
17:45:35 PDT ---
Fixed for D1.

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


[Issue 7810] [CTFE] Typesafe variadic function with array of structs

2012-10-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7810



--- Comment #9 from Don clugd...@yahoo.com.au 2012-10-01 06:17:47 PDT ---
Further reduced shows it's a problem with void initialized static arrays. I
have a fix.

int bug7810() {

int[1][3] x = void;
x[0] = [2];
x[1] = [7];
assert(x[0][0] == 2);
return 1;
}
static assert(bug7810());

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


[Issue 7810] [CTFE] Typesafe variadic function with array of structs

2012-10-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7810



--- Comment #10 from Don clugd...@yahoo.com.au 2012-10-01 07:16:00 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1155

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


[Issue 7810] [CTFE] Typesafe variadic function with array of structs

2012-09-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7810



--- Comment #7 from Don clugd...@yahoo.com.au 2012-09-28 00:01:52 PDT ---
Problem happens when an array is initialized to void in global scope (outside
of CTFE) and then modified in CTFE. Haven't fixed this yet.

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


[Issue 7810] [CTFE] Typesafe variadic function with array of structs

2012-09-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7810



--- Comment #8 from Dmitry Olshansky dmitry.o...@gmail.com 2012-09-28 
03:08:46 PDT ---
(In reply to comment #7)
 Problem happens when an array is initialized to void in global scope (outside
 of CTFE) and then modified in CTFE. Haven't fixed this yet.

Thanks for looking into it. 
It took soo long to reduce but at least now I have an idea of a workaround.

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


[Issue 7810] [CTFE] Typesafe variadic function with array of structs

2012-09-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7810


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

   What|Removed |Added

Summary|ctRegex!`a|b` asserts at|[CTFE] Typesafe variadic
   |regex.d:1150|function with array of
   ||structs


--- Comment #6 from Dmitry Olshansky dmitry.o...@gmail.com 2012-09-26 
11:47:45 PDT ---
I've finally pinned down this bugger. 
The problem is in typesafe variadic function if the parameter type is a struct.

See simple test below:
//encoded IR instruction
struct Bytecode
{
uint raw;
}

int fn1(T)(T[] items...)
{
assert(items[0] == 20);
return 42;
}

int fn2(T)(T[] items...)
{
assert(items[0] == Bytecode(20));
return 42;
}

//this passes...
static assert(fn1(20, 30) == 42); 

//this dies inside of fn2
static assert(fn2(Bytecode(20), Bytecode(30)) == 42); 

void main()
{//both of these pass at R-T
assert(fn1(20, 30) == 42); 
assert(fn2(Bytecode(20), Bytecode(30)) == 42);
}

Output:

sr_micro.d(15): Error: assert(items[0u] == Bytecode(20u)) failed
sr_micro.d(23):called from here: fn2((Bytecode[2u] __arrayArg6 = void;
 , __arrayArg6[0u] = Bytecode(20u) , __arrayArg6[1u] = Bytecode(30u) ,
cast(Bytecode[])__arrayArg6))
sr_micro.d(23):while evaluating: static assert(fn2((Bytecode[2u]
__arrayArg6 = void;
 , __arrayArg6[0u] = Bytecode(20u) , __arrayArg6[1u] = Bytecode(30u) ,
cast(Bytecode[])__arrayArg6)) == 42)

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