[Issue 3281] ICE(cod1.c) append returned struct to array

2009-09-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3281





--- Comment #1 from Don   2009-09-02 12:19:08 PDT ---
Good news: This is already fixed in DMD 2.032, which will hopefully be released
tomorrow.

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


[Issue 2935] ICE(out.c) using struct with constructor as function default argument

2009-09-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2935


Don  changed:

   What|Removed |Added

   Keywords||patch




--- Comment #1 from Don   2009-09-02 12:15:57 PDT ---
Same root cause as bug 2437, and the same simple patch fixes it.

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


[Issue 2437] ICE(tocsym.c, !needThis()) - default struct argument

2009-09-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2437





--- Comment #2 from Don   2009-09-02 12:11:01 PDT ---
The root cause is in func.c, FuncDeclaration::semantic(Scope *sc)

Around line 240, we read:

sd = parent->isStructDeclaration();
if (sd)
{
if (isCtorDeclaration())
{
return;// <== this is a problem!
}

Returning at this point means that the scope isn't saved. This prevents the
later semantic passes from running, in certain cases. Commenting out the return
prevents the ICE. I haven't yet checked this patch on the test suite, it could
be that additional changes are required. But the problems begin here.

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


[Issue 3281] New: append returned struct to array: Internal error: ../ztc/cod1.c 168

2009-09-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3281

   Summary: append returned struct to array: Internal error:
../ztc/cod1.c 168
   Product: D
   Version: 2.031
  Platform: Other
OS/Version: Linux
Status: NEW
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: peng2che...@yahoo.com


import std.stdio;

struct S {string s; this(string x){s=x;}}

immutable(S) mkS(){
  return S("mks hi");
}

void main(char[][] args) {
  immutable(S) s = mkS();
  immutable(S)[] ss;
  ss ~= S("plain hi");
  ss ~= cast(immutable(S)) S("plain hi");
  //ss ~=  mkS(); // --> "Internal error: ../ztc/cod1.c 1684"
  writeln(s.s, ", ", ss[0].s);
}


I think (hope?) this is all valid code. I.e.,

  ss ~= S("Hi"); //should be ok
  ss.length = ss.length + 1;
  ss[$-1] = S("plain hi"); //should fail to compile (as it indeed does)

In any case there is an ICE.




Error: ss[0] isn't mutable
Error: ss[0] isn't mutable

  //ss[0] = S("fail"); --> Error: ss[0] isn't mutable

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


[Issue 3204] Document global properties

2009-09-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3204





--- Comment #3 from Walter Bright   2009-09-02 
01:20:11 PDT ---
No real reason for them to exist.

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


[Issue 2998] ICE(expression.c) with floating point enum

2009-09-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2998





--- Comment #2 from Don   2009-09-02 00:33:56 PDT ---
Created an attachment (id=443)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=443)
enum.c for DMD2.032

Fixes many of the problems with enums. Tested with the pre-release DMD2.032
beta.
D2 only.

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


[Issue 2998] ICE(expression.c) with floating point enum

2009-09-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2998


Don  changed:

   What|Removed |Added

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




--- Comment #1 from Don   2009-09-02 00:32:14 PDT ---

PATCH: enum.c, in EnumDeclaration::semantic(), around line 195.
The interpret optimisation should be done BEFORE the cast. Just swap the order.
Otherwise, constfold functions such as Add() think it's an enum type, not a
real, and so they default to integer, and chaos ensues.

// Now set e to (elast + 1)
e = new AddExp(em->loc, elast, new IntegerExp(em->loc, 1,
Type::tint32));
e = e->semantic(sce);
+e = e->optimize(WANTvalue | WANTinterpret);
e = e->castTo(sce, elast->type);
-e = e->optimize(WANTvalue | WANTinterpret);



However, there are other problems in this function. If you try to use a struct
inside an enum, you get garbage error messages without line number; you find
that you need to define a .max() property for the struct,  and error messages
are repeated. I attach a revised enum.c which fixes these problems, and allows
the code below to work correctly:

enum G : real { a, b }
enum E : real { a=18.0, b }
enum F : real { c=E.b, d }

struct S{
   int x;
   S opAdd(int q) { return S(x+1);} 
   int opCmp(S s) { return x < s.x; }
}
enum H : S { a=S(0), b}

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