[Issue 3792] Regression: non-constant expression for a template inside a struct using a struct initializer

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3792



--- Comment #3 from Fawzi Mohamed fa...@gmx.ch 2010-03-08 00:27:59 PST ---
This bug is listed as fixed in 1.057, but while the reduced case by Matti
Niemenmaa is indeed fixed, the original testcase still fails (I am pointing it
out so that it stays open...)

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


[Issue 3892] New: Built-in set type similar to associative arrays

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3892

   Summary: Built-in set type similar to associative arrays
   Product: D
   Version: 2.030
  Platform: All
OS/Version: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: justin.spahrsumm...@gmail.com


--- Comment #0 from Justin Spahr-Summers justin.spahrsumm...@gmail.com 
2010-03-08 03:03:42 CST ---
It's rather low priority, but it'd be nice to have built-in set functionality
(here meaning an unordered data structure where no duplicate values can exist).
Associative arrays can already fill the role to some extent if you just opt not
to use the values at all, but that's a waste of storage.

Syntax could even be similar, using void in place of a value type:

---
void main () {
void[string] set;

set.add(hello);
assert(hello in set);

set.add(hello);
set.remove(hello);
assert(!(hello in set));
}
---

If creating a new property (add) is out of the question, even something
like...
set[hello] = true;
could work.

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


[Issue 3893] New: opOpAssign and opIndexOpAssign get wrong operator string

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3893

   Summary: opOpAssign and opIndexOpAssign get wrong operator
string
   Product: D
   Version: 2.041
  Platform: All
OS/Version: All
Status: NEW
  Severity: critical
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bugzi...@kyllingen.net


--- Comment #0 from Lars T. Kyllingstad bugzi...@kyllingen.net 2010-03-08 
01:52:06 PST ---
The specification says:

The expression: a op= b
is rewritten as: a.opOpAssign!(op)(b)

A similar statement is made about opIndexOpAssign. However, what actually
happens is that the template parameter is set to op=, as this program shows:

struct S
{
void opIndexOpAssign(string op)(int x, int i)
{
pragma (msg, op);
}

void opOpAssign(string op)(int x)
{
pragma(msg, op);
}
}

void main()
{
S s;
s[1] += 2;
s += 3;
}

This prints the following on compilation:

  +=
  +=

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


[Issue 3894] New: std.range.Stride!R requires R.front() and R.back() to return by reference

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3894

   Summary: std.range.Stride!R requires R.front() and R.back() to
return by reference
   Product: D
   Version: 2.041
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: bugzi...@kyllingen.net


--- Comment #0 from Lars T. Kyllingstad bugzi...@kyllingen.net 2010-03-08 
03:58:32 PST ---
Quoting Mihail Strashun on the digitalmars.D.learn newsgroup:
---
Following simple program fails to compile with latest DMD 2.041 (In fact it
fails to compile with any dmd2 version i have tried):

test.d
 import std.stdio;
 import std.range;
 import std.algorithm;

 int main()
 {
   auto test = stride( iota(0,10,1) , 2 );
   return 0;
 }

Output:
[m...@mistwork d]$ dmd -run test.d
/usr/include/d/std/range.d(716): Error: this._input.front() is not an lvalue
/usr/include/d/std/range.d(724): Error: this._input.back() is not an lvalue
---

The problem is that Stride.front() and Stride.back() are defined to return by
reference, which is not the case for all ranges.

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


[Issue 3895] New: Appending a double[] to a float[] no longer works.

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3895

   Summary: Appending a double[] to a float[] no longer works.
   Product: D
   Version: 2.041
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: wrong-code
  Severity: regression
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: dsim...@yahoo.com


--- Comment #0 from David Simcha dsim...@yahoo.com 2010-03-08 06:22:04 PST ---
import std.stdio;

void main() {
double[] stuff = [1.,2.,3.,4.,5.];
float[] otherStuff;
otherStuff ~= stuff;
writeln(otherStuff);
}


Output:

0 1.875 0 2 0 2.125 0 2.25 0 2.3125

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


[Issue 3896] New: Broken links

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3896

   Summary: Broken links
   Product: D
   Version: unspecified
  Platform: Other
OS/Version: Mac OS X
Status: NEW
  Severity: minor
  Priority: P2
 Component: www.digitalmars.com
AssignedTo: nob...@puremagic.com
ReportedBy: bio...@free.fr


--- Comment #0 from biozic bio...@free.fr 2010-03-08 06:25:25 PST ---
Page std.algorithm: links to the glossary are broken (repetition of 2.0 in the
URL).

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


[Issue 3895] Appending a double[] to a float[] no longer works.

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3895


Steven Schveighoffer schvei...@yahoo.com changed:

   What|Removed |Added

 CC||schvei...@yahoo.com


--- Comment #1 from Steven Schveighoffer schvei...@yahoo.com 2010-03-08 
06:34:29 PST ---
When did this work?  I tested back to 2.036 and it still results in the same
output (was testing in case it was something I did in my append patch).

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


[Issue 3897] New: Sporadic incorrectness with builtin AAs

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3897

   Summary: Sporadic incorrectness with builtin AAs
   Product: D
   Version: 2.041
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: regression
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: dsim...@yahoo.com


--- Comment #0 from David Simcha dsim...@yahoo.com 2010-03-08 06:38:43 PST ---
Here's about the best I can do to reproduce this issue.  It showed up in a
monte carlo unittest of one of my associative array implementations that tested
whether it gets the same answers as the builtin implementation.  Probably some
subtle memory corruption issue.

import std.stdio, std.random, std.conv;

void main() {
// Monte carlo unit test builtin hash table.
uint[uint] table;
auto gen = Random(42);
foreach(i; 0..1_000_000) {
auto num1 = gen.front();
gen.popFront();
auto num2 = gen.front();
gen.popFront();

table[num1] = num2;
}

// Note that we're using the same seed again.
gen = Random(42);
foreach(i; 0..1_000_000) {
auto num1 = gen.front();
gen.popFront();
auto num2 = gen.front();
gen.popFront();

assert(num1 in table);
assert(table[num1] == num2);
}
}

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


[Issue 3897] Sporadic incorrectness with builtin AAs

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3897


David Simcha dsim...@yahoo.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||INVALID


--- Comment #1 from David Simcha dsim...@yahoo.com 2010-03-08 06:54:19 PST ---
Never mind.  I filed this report in a hurry.  While I still think something
screwy is going on with the builtin AAs, this is not a valid way to reproduce
it.  Will file a new report when I have more time to look into the problem.

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


[Issue 3898] New: access violation with associative arrays

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3898

   Summary: access violation with associative arrays
   Product: D
   Version: 2.041
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: regression
  Priority: P2
 Component: druntime
AssignedTo: s...@invisibleduck.org
ReportedBy: r.sagita...@gmx.de


--- Comment #0 from Rainer Schuetze r.sagita...@gmx.de 2010-03-08 07:24:53 
PST ---
the following test case crashes in version 2.041

import std.conv;

void main()
{
int[string] aa;
for(int i = 0; i  10; i++)
{
string s = to!string(i);
aa[s] = i;
}
}

while it worked with 2.040 and earlier. The access violation is in _aaBalance
and very much looks like a memory corruption.

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


[Issue 3895] Appending a double[] to a float[] no longer works.

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3895


David Simcha dsim...@yahoo.com changed:

   What|Removed |Added

   Severity|regression  |major


--- Comment #2 from David Simcha dsim...@yahoo.com 2010-03-08 07:50:20 PST ---
You're right.  What I can't figure out is how code that depended on this
working seemed to work until now.  It might have something to do with changes
to the Appender struct, since the code that I noticed this in actually used an
Appender instead of appending using ~=.

Changing status from regression to major.

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


[Issue 1355] Can't declare struct with align attribute in a statement body.

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1355


Manuel K�nig manuel...@gmx.net changed:

   What|Removed |Added

 CC||manuel...@gmx.net


--- Comment #1 from Manuel K�nig manuel...@gmx.net 2010-03-08 09:33:11 PST ---
I ran into this bug on LDC too (don't have dmd at hand), see this closed bug:
http://www.dsource.org/projects/ldc/ticket/399 .

It turns out that it's probably a parse error (which implies that it's most
likely not implemented in the back end too). Christian Kamm could also
reproduce this on dmd. I don't know which version he used though, probably one
of the newer 1.05x releases.

As a workaround you can of course declare the struct on module level.

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


[Issue 3899] New: CTFE: poor error message for use of uninitialized variable

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3899

   Summary: CTFE: poor error message for use of uninitialized
variable
   Product: D
   Version: 1.055
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: diagnostic
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don clugd...@yahoo.com.au 2010-03-08 11:16:54 PST ---
The code below generates the error void initializer has no value
which is a bit unclear.
(I'm entering this bug only because I've fixed it in another patch).
=

int gar()
{
   ArrayRet z = void;
   ArrayRet w = z;
   z.x += 2;
   return z.x;
}
static assert(gar()==2);

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


[Issue 3900] New: CTFE: Wrong return value for array.var assignment

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3900

   Summary: CTFE: Wrong return value for array.var assignment
   Product: D
   Version: 1.055
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: rejects-valid
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don clugd...@yahoo.com.au 2010-03-08 11:21:11 PST ---
struct ArrayRet{
   int x;
}

int arrayRetTest(int z)
{
  ArrayRet[6] w;
  int q = (w[3].x = z);
  return q;  
}

static assert(arrayRetTest(51)==51);
==

bug.d(23): Error: static assert  ([(ArrayRet(0)),(ArrayRet(0)),(ArrayRet(0)),(A
rrayRet(51)),(ArrayRet(0)),(ArrayRet(0))] == 51) is not evaluatable at compile
t
ime

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


[Issue 3901] New: PATCH: Nested struct assignment for CTFE

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3901

   Summary: PATCH: Nested struct assignment for CTFE
   Product: D
   Version: 1.055
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: patch, rejects-valid
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don clugd...@yahoo.com.au 2010-03-08 11:29:16 PST ---
This is a MAJOR refactoring of assignment in CTFE. The assign function was a
big mess. A lot of work, and there's not really much to show for it from 
a user's perspective. But it's a solid platform to allow the final CTFE bugs to
be fixed.

To install this patch, you need to add a single function to mtype.c, and
completely replace interpret.c with the attachment.(There are so many changes,
that a patch doesn't make sense).
Fortunately the test suite file interpret.d is getting quite extensive.
And these new tests do some pretty evil things...

==

New features:
* Arbitrary nested struct assignment now works in CTFE.
  a.b.c.d = e;
  a[i].b.c.d = e;
* ref return values now work in CTFE (D2 only).

BUGS FIXED:
3842 ICE(expression.c) using pointer in CTFE
3899 CTFE: poor error message for use of uninitialized variable
3900 CTFE: Wrong return value for array.var assignment


  PATCH for mtype.c: ===


--- mtype.c(revision 409)
+++ mtype.c(working copy)
@@ -3451,6 +3451,21 @@
 return next-isZeroInit(loc);
 }

+Expression *TypeSArray::defaultInitLiteral(Loc loc)
+{
+#if LOGDEFAULTINIT
+printf(TypeSArray::defaultInitLiteral() '%s'\n, toChars());
+#endif
+size_t d = dim-toInteger();
+Expression *elementinit = next-defaultInitLiteral(loc);
+Expressions *elements = new Expressions();
+elements-setDim(d);
+for (size_t i = 0; i  d; i++)
+ elements-data[i] = elementinit;
+ArrayLiteralExp *ae = new ArrayLiteralExp(0, elements);
+ae-type = this;
+return ae;
+}

 Expression *TypeSArray::toExpression()
 {
Index: mtype.h
===
--- mtype.h(revision 409)
+++ mtype.h(working copy)
@@ -406,6 +406,7 @@
 MATCH constConv(Type *to);
 MATCH implicitConvTo(Type *to);
 Expression *defaultInit(Loc loc);
+Expression *defaultInitLiteral(Loc loc);
 dt_t **toDt(dt_t **pdt);
 dt_t **toDtElem(dt_t **pdt, Expression *e);
 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters,
Objects *dedtypes);



= Test cases for test suite. ===



struct ArrayRet{
   int x;
}

int arrayRetTest(int z)
{
  ArrayRet[6] w;
  int q = (w[3].x = z);
  return q;  
}

static assert(arrayRetTest(51)==51);

// Bugzilla 3842 -- must not segfault
int ice3842(int z)
{
   ArrayRet w;
   return arrayRetTest((*(w)).x);   
}

static assert(true || is(typeof(compiles!(ice3842(51);


int arrayret2(){

  int [5] a;
  int [3] b;
  b[] = a[1..$-1] = 5;
  return b[1];
}
static assert(arrayret2()==5);

struct DotVarTest
{
   ArrayRet z;
}

struct DotVarTest2
{
   ArrayRet z;
   DotVarTest p;
}

int dotvar1()
{
DotVarTest w;
w.z.x = 3;
return w.z.x; 
}

int dotvar2()
{
DotVarTest2[4] m;
m[2].z.x = 3;
m[1].p.z.x = 5;
return m[2].z.x + 7;
}

static assert(dotvar1()==3);
static assert(dotvar2()==10);


struct RetRefStruct{
   int x;
   char c;
}

// Return value reference tests, for D2 only.

ref RetRefStruct reffunc1(ref RetRefStruct a)
{
int y = a.x;
return a;
}


ref RetRefStruct reffunc2(ref RetRefStruct a)
{
   RetRefStruct z = a;
   return reffunc1(a);
}

ref int reffunc7(ref RetRefStruct aa)
{
   return reffunc1(aa).x;
}

ref int reffunc3(ref int a)
{
return a;
}

struct RefTestStruct
{
  RetRefStruct r;

  ref RefTestStruct reffunc4(ref RetRefStruct[3] a)
  {
return this;
  }

  ref int reffunc6()
  {
return this.r.x;
  }
}

ref RetRefStruct reffunc5(ref RetRefStruct[3] a)
{
   int t = 1;
   for (int i=0; i10; ++i)
   { if (i==7)  ++t;}
return a[reffunc3(t)];
}

int retRefTest1()
{
RetRefStruct b = RetRefStruct(0,'a');
reffunc1(b).x =3;
return b.x-1;
}

int retRefTest2()
{
RetRefStruct b = RetRefStruct(0,'a');
reffunc2(b).x =3;
RetRefStruct[3] z;
RefTestStruct w;
w.reffunc4(z).reffunc4(z).r.x = 4;
assert(w.r.x == 4);
w.reffunc6() = 218;
assert(w.r.x == 218);
z[2].x = 3;
int q=4;
int u = reffunc5(z).x + reffunc3(q);
assert(u==7);
reffunc5(z).x += 7;
assert(z[2].x == 10);
RetRefStruct m = RetRefStruct(7, 'c');
m.x = 6;
reffunc7(m)+=3;
assert(m.x==9);
return b.x-1;
}

int retRefTest3()
{

[Issue 3901] PATCH: Nested struct assignment for CTFE

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3901



--- Comment #1 from Don clugd...@yahoo.com.au 2010-03-08 11:32:25 PST ---
Created an attachment (id=586)
Patch against DMD2.041 svn 409.

Drop-in replacement for interpret.c for DMD2.041. Also works without
modification for D1. Also needs the change to mtype.c.

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


[Issue 3899] CTFE: poor error message for use of uninitialized variable

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3899


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

   What|Removed |Added

   Keywords||patch


--- Comment #1 from Don clugd...@yahoo.com.au 2010-03-08 11:33:10 PST ---
Patched in bug 3901.

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


[Issue 3900] CTFE: Wrong return value for array.var assignment

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3900


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

   What|Removed |Added

   Keywords||patch


--- Comment #1 from Don clugd...@yahoo.com.au 2010-03-08 11:33:36 PST ---
Patched in bug 3901.

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


[Issue 3878] Arguments and attributes with the same name

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3878


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

   What|Removed |Added

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


--- Comment #2 from Don clugd...@yahoo.com.au 2010-03-08 13:09:53 PST ---
As I understand option(2) of this proposal, if a function parameter 'shadows' a
member variable of the same name, it should be illegal to use that parameter as
an lvalue.

I think you're probably correct in claiming that any such code is highly likely
to be a bug. If x is both a parameter and a member, then
x = 3;   should almost certainly be 
this.x = 3;

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


[Issue 3901] PATCH: Nested struct assignment for CTFE

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3901


bearophile_h...@eml.cc changed:

   What|Removed |Added

 CC||bearophile_h...@eml.cc


--- Comment #2 from bearophile_h...@eml.cc 2010-03-08 13:21:44 PST ---
Thank you for all such big work.


 New features:
...
 * ref return values now work in CTFE (D2 only).

So is this fixing bug 2411 too?

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


[Issue 3694] Template this parameters don't work with operator overloads

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3694



--- Comment #2 from gareth.charn...@gmail.com 2010-03-08 13:30:49 PST ---
Bug appears to be fixed in DMD 2.041. Both test cases compile fine now.

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


[Issue 3902] New: Definition of opCmp

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3902

   Summary: Definition of opCmp
   Product: D
   Version: 2.041
  Platform: Other
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: www.digitalmars.com
AssignedTo: nob...@puremagic.com
ReportedBy: norb...@nemec-online.de


--- Comment #0 from Norbert Nemec norb...@nemec-online.de 2010-03-08 14:42:44 
PST ---
Strangeness in the definition of opCmp:

http://www.digitalmars.com/d/2.0/operatoroverloading.html#compare

Mathematically the following are equivalent
a  b   =   b  a

But the definition seems to swap
a  b into  b = a

DMD seems to work correctly, though.

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


[Issue 3903] New: Traits compiles as true for an array sum with wrong syntax

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3903

   Summary: Traits compiles as true for an array sum with wrong
syntax
   Product: D
   Version: 2.041
  Platform: x86
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2010-03-08 15:04:06 PST ---
This compiles, but the traits has to return 'false' here:

void main() {
int[2] a = [1, 2];
assert( __traits(compiles, {return a + a;}) );
//auto r = a + a; // error
}

See also bug 3817 .

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


[Issue 3904] New: Infer function type from an alias in a template

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3904

   Summary: Infer function type from an alias in a template
   Product: D
   Version: 2.041
  Platform: x86
OS/Version: Windows
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2010-03-08 15:27:19 PST ---
I think the compiler can infer the type here:


template Type(T) { alias T Type; }
void bar(T)(Type!T t) {}
void main() {
int b = 1;
bar!int(b); // OK
bar(b); // template test.bar(T) does not match any function template
declaration
}


Problem found by Nicolas / biozic:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learnarticle_id=19054


The original code was:

template Graph(T) {
 alias T[][T] Graph;
}
void add_edge(T)(ref Graph!(T) graph, T source, T target) {
 graph[source] ~= target;
}
void main() {
 Graph!(string) graph;
 graph.add_edge(A, B); // Error
}

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


[Issue 3907] New: @ attributes not part of grammar

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3907

   Summary: @ attributes not part of grammar
   Product: D
   Version: 2.041
  Platform: All
   URL: http://digitalmars.com/d/2.0/lex.html
OS/Version: All
Status: NEW
  Keywords: spec
  Severity: normal
  Priority: P2
 Component: www.digitalmars.com
AssignedTo: nob...@puremagic.com
ReportedBy: jlqu...@optonline.net


--- Comment #0 from Jerry Quinn jlqu...@optonline.net 2010-03-08 22:03:40 PST 
---
The docs mention several attributes starting with @.  The lexical docs don't
mention @ at all.

Is i.e. @property a special token?  Or is @ a token followed by the text
property?  Is whitespace permitted between @ and the remainder of the
attribute?

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


[Issue 3908] New: @ attributes not part of function grammar

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3908

   Summary: @ attributes not part of function grammar
   Product: D
   Version: 2.041
  Platform: All
   URL: http://digitalmars.com/d/2.0/function.html
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: www.digitalmars.com
AssignedTo: nob...@puremagic.com
ReportedBy: jlqu...@optonline.net


--- Comment #0 from Jerry Quinn jlqu...@optonline.net 2010-03-08 22:06:16 PST 
---
@safe, @trusted, @property, @system attributes are all described in text, but
missing from the language grammar.

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


[Issue 2321] spec on inline asm can be misunderstood

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2321


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

   What|Removed |Added

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


--- Comment #2 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:18:10 PST ---
Fixed dmd 1.057 and 2.041

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


[Issue 2463] No line number in statement is not reachable warning

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2463


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #6 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:18:31 PST ---
Fixed dmd 1.057 and 2.041

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


[Issue 2567] [patch] Option To Not Treat Warnings As Errors

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2567


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #4 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:19:05 PST ---
Added -wi switch for dmd 1.057 and 2.041

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


[Issue 3306] bad function/delegate literal generated into header files

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3306


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #4 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:19:39 PST ---
Fixed dmd 1.057 and 2.041

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


[Issue 3373] bad codeview debug info for long and ulong

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3373


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #3 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:19:56 PST ---
Fixed dmd 1.057 and 2.041

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


[Issue 3420] [PATCH] Allow string import of files using subdirectories

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3420



--- Comment #17 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:20:35 PST ---
Posix-only fix in dmd 1.057 and 2.041

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


[Issue 3450] incorrect result for is (typeof({ ... }())) inside a struct

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3450


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #4 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:20:53 PST ---
Fixed dmd 1.057 and 2.041

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


[Issue 3500] super behaves differently with -inline

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3500


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #5 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:21:10 PST ---
Fixed dmd 1.057 and 2.041

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


[Issue 3558] Optimizer bug results in false if condition being taken

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3558


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #7 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:21:27 PST ---
Fixed dmd 1.057 and 2.041

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


[Issue 3670] Declarator grammar rule is broken

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3670


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #2 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:21:46 PST ---
Fixed dmd 1.057 and 2.041

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


[Issue 3737] SEG-V at expression.c:6255 from bad opDispatch

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3737


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #9 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:22:36 PST ---
Fixed dmd 1.057 and 2.041

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


[Issue 3768] reapeted quotes in ddoc.html

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3768


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

   What|Removed |Added

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


--- Comment #1 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:22:52 PST ---
Fixed dmd 1.057 and 2.041

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


[Issue 3775] Segfault(cast.c): casting no-parameter template function using property syntax

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3775


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #5 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:23:27 PST ---
Fixed dmd 1.057 and 2.041

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


[Issue 3781] ICE(interpret.c): using no-argument C-style variadic function in CTFE

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3781


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #4 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:23:42 PST ---
Fixed dmd 1.057 and 2.041

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


[Issue 3803] compiler segfaults

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3803


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

   What|Removed |Added

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


--- Comment #5 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:23:57 PST ---
Fixed dmd 1.057 and 2.041

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


[Issue 3840] Jump to: section in the docs should be sorted

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3840


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

   What|Removed |Added

 CC||bugzi...@digitalmars.com


--- Comment #1 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:24:17 PST ---
Fixed dmd 1.057 and 2.041

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


[Issue 3792] Regression: non-constant expression for a template inside a struct using a struct initializer

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3792


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

   What|Removed |Added

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


--- Comment #4 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:24:37 PST ---
Fixed dmd 1.057

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


[Issue 3453] Linking order affects proper execution (Mac OSX only)

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3453


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #9 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:25:24 PST ---
Fixed dmd 2.041

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


[Issue 3491] typeof( (string[string]).init)) == AssociativeArray!(string, string), doesn't implicitly convert to string[string].

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3491


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

   What|Removed |Added

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


--- Comment #3 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:25:41 PST ---
Fixed dmd 2.041

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


[Issue 3619] Thread crash on exit

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3619


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

   What|Removed |Added

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


--- Comment #1 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:26:14 PST ---
Fixed dmd 2.041

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


[Issue 3637] Array append patch to prevent stomping and to enhance thread-local append performance

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3637


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

   What|Removed |Added

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


--- Comment #9 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:26:33 PST ---
Fixed dmd 2.041

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


[Issue 3644] Wrong UCHAR_MAX value in module core.stdc.limits

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3644


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

   What|Removed |Added

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


--- Comment #2 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:26:50 PST ---
Fixed dmd 2.041

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


[Issue 3689] Grammar does not allow const(int)

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3689


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #2 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:27:05 PST ---
Fixed dmd 2.041

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


[Issue 3692] ICE(mtype.c) with associative arrays when std.variant is imported

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3692


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

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution||FIXED


--- Comment #8 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:27:23 PST ---
Fixed dmd 2.041

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


[Issue 3695] __EOF__ token not documented

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3695


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #3 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:27:42 PST ---
Fixed dmd 2.041

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


[Issue 3697] StructTemplateDeclaration and others missing constraint in rule

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3697


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #2 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:27:59 PST ---
Fixed dmd 2.041

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


[Issue 3763] std.stdio.readlnImpl absurdly inefficient and overflows stack

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3763


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

   What|Removed |Added

 CC||bugzi...@digitalmars.com


--- Comment #6 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:28:15 PST ---
Fixed dmd 2.041

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


[Issue 3776] Wrong CHAR_MIN value in module core.stdc.limits

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3776


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

   What|Removed |Added

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


--- Comment #1 from Walter Bright bugzi...@digitalmars.com 2010-03-08 
22:28:38 PST ---
Fixed dmd 2.041

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


[Issue 3909] New: toDelegate handles only a tiny subset of function pointer types

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3909

   Summary: toDelegate handles only a tiny subset of function
pointer types
   Product: D
   Version: 2.041
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: major
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: samu...@voliacable.com


--- Comment #0 from Max Samukha samu...@voliacable.com 2010-03-08 23:33:42 
PST ---
Current implementation of toDelegate requires parameter and return types of the
argument to be accessible from std.functional, meaning that it won't accept
most of function pointers taking or returning instances of UDTs:


import std.functional;

struct S
{
}

void foo(S s)
{
}

void main()
{
auto dg = toDelegate(foo);
}

Error: identifier 'S' is not defined


The cause is the mixed-in delegate type generated from the function pointer
type's stringof, which is invalid in the context of the template declaration.
A workaround is to avoid the stringof like this:

alias ParameterTypeTuple!(F) Params;
// mixed-in string:
alias storage classes ReturnType!(F) delegate(storage classes Params[0],
... storage classes Params[$ - 1]) Dg;

where storage classes are extracted from F's stringof (isRef, isOut, isLazy
may work too)

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