[Issue 3227] New: Segfault(mtype.c) anonymous delegate with void parameter

2009-08-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3227

   Summary: Segfault(mtype.c) anonymous delegate with void
parameter
   Product: D
   Version: 2.031
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: ice-on-invalid-code
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: clugd...@yahoo.com.au



auto x = (void){};

ice.d(1): Error: cannot have parameter of type void
ice.d(1): Error: cannot have parameter of type void
segfault


Does not segfault on D1.

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


[Issue 3228] New: Segfault(mtype.c) multiple empty delegates

2009-08-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3228

   Summary: Segfault(mtype.c) multiple empty delegates
   Product: D
   Version: 2.031
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: ice-on-invalid-code
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: clugd...@yahoo.com.au


This has to be the funniest looking bug I've ever made. 

void main(){ (){}; (){}; }

ice.d(1): Error: function has no effect in expression (__dgliteral1)
segfault

Probably the same as bug #3227, it's segfaulting in the same place, and doesn't
segfault on D2.

This smiley variant should compile without errors. But it just segfaults.

---
static assert(!is(typeof((){(){}
 ;-()
{};})));

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


[Issue 3196] Segfault(mtype.c) Bad struct declaration before a anonymous delegate within the parameter list

2009-08-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3196


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

   What|Removed |Added

 CC||clugd...@yahoo.com.au
Summary|Bad struct declaration  |Segfault(mtype.c) Bad
   |before a anonymous delegate |struct declaration before a
   |within the parameter list   |anonymous delegate within
   |show a segment fault|the parameter list




--- Comment #1 from Don clugd...@yahoo.com.au  2009-08-05 01:01:53 PDT ---
Bug #3227 and bug #3228 are probably duplicates of this one.

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


[Issue 2575] gdb can not show code

2009-08-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2575





--- Comment #9 from Walter Bright bugzi...@digitalmars.com  2009-08-05 
01:21:42 PDT ---
I'll add the MIPS_linkage tag and change the name tag. We'll see how far that
gets us.

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


[Issue 3229] New: No return or assert(0) at end of function

2009-08-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3229

   Summary: No return or assert(0) at end of function
   Product: D
   Version: 2.031
  Platform: Other
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: jason.james.ho...@gmail.com


This error pops up incorrectly after a final switch full of return statements.

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


[Issue 1977] Relax warnings for implicit narrowing conversions caused by promotions

2009-08-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1977


Jason House jason.james.ho...@gmail.com changed:

   What|Removed |Added

 CC||jason.james.ho...@gmail.com




--- Comment #20 from Jason House jason.james.ho...@gmail.com  2009-08-05 
06:11:47 PDT ---
Here's a related issue:

long a;
...
int b = a % 1000;

The sample above gives an error that it can't implicitly convert to int, even
though this us exactly the kind of thing implicit narrowing conversions should
handle.

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


[Issue 3176] Out of Memory error on poorly formed recurrence function

2009-08-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3176


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

   What|Removed |Added

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




--- Comment #1 from Don clugd...@yahoo.com.au  2009-08-05 07:15:26 PDT ---
Massively reduced test case:

struct C(T){
ref T opIndex(size_t n) { T t; return t[0]; }
}

void foo(S...)(S u) {
alias typeof(mixin({ C!(void) a; return a[1;}())) z;
}

void main() {
   foo!()(0);
}

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


[Issue 3176] Compiler hangs on poorly formed recurrence function

2009-08-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3176


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

   What|Removed |Added

Summary|Out of Memory error on  |Compiler hangs on poorly
   |poorly formed recurrence|formed recurrence function
   |function|
 OS/Version|Linux   |All
   Severity|minor   |major




--- Comment #2 from Don clugd...@yahoo.com.au  2009-08-05 08:18:18 PDT ---
Gets into an infinite loop while parsing the mixin.

Here's a superficial patch, which turns it into an ICE with line number.
Doesn't fix the root cause, but still an improvement.
parse.c, line 3358:

while (token.value != TOKrcurly)
{
 +   if (token.value==TOKeof) { 
 +   printf(%s Internal Compiler Error: } expected, not EOF\n,
 +   loc.toChars());
 +   assert(0);
 +   }

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


[Issue 3230] New: std.conv should provide facilities for converting from Roman numerals.

2009-08-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3230

   Summary: std.conv should provide facilities for converting from
Roman numerals.
   Product: D
   Version: 2.031
  Platform: All
OS/Version: All
Status: NEW
  Keywords: patch
  Severity: enhancement
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: dsim...@yahoo.com


Pretty simple, without further ado here's the patch.  Just to be absolutely
clear, I wrote this code snippet entirely by myself and hereby release it into
the public domain.

// Converts a single digit from Roman to arabic.
private uint convertDigit(char digit) pure {
switch(digit) {
case 'I' :
return 1;
case 'V' :
return 5;
case 'X' :
return 10;
case 'L' :
return 50;
case 'C' :
return 100;
case 'D' :
return 500;
case 'M' :
return 1000;
default :
throw new ConvError(
Could not convert Roman digit  ~ digit ~  to a number.);
}
assert(0);
}

/**Converts a string containing a Roman numeral to an unsigned integer
 * representation.
 *
 * Throws:  ConvError on invalid Roman digit.
 */
uint romanToInt(const char[] roman) pure {
uint result = 0;
uint maxDigit = 0;

for(size_t i = roman.length - 1; i != size_t.max; i--) {
auto romanDigit = roman[i];
uint arabic = convertDigit(romanDigit);

if(arabic  maxDigit) {
maxDigit = arabic;
}

// Should we add or subtract?
if(arabic = maxDigit) {
result += arabic;
} else {
result -= arabic;
}
}
return result;
}

unittest {
assert(romanToInt(XIX) == 19);
assert(romanToInt(DCLXVI) == 666);
assert(romanToInt(XXX) == 30);
assert(romanToInt(MDCCCLXXXVIII) == 1888);
assert(romanToInt(XCIX) == 99);
assert(romanToInt(XLIX) == 49);
assert(romanToInt(IV) == 4);
assert(romanToInt(XLV) == 45);
}

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


[Issue 3229] No return or assert(0) at end of function

2009-08-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3229


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

   What|Removed |Added

 CC||bugzi...@digitalmars.com




--- Comment #1 from Walter Bright bugzi...@digitalmars.com  2009-08-05 
14:12:20 PDT ---
Example, please!

(Yes, I know, why don't I just write one? Because most of the time when I write
one and guess at the details, the problem does not occur, because the
description omits crucial information.)

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


[Issue 3229] No return or assert(0) at end of function

2009-08-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3229





--- Comment #2 from Jason House jason.james.ho...@gmail.com  2009-08-05 
16:53:47 PDT ---
Your wish is my demand!

int main(){
  enum foo{ bar };
  foo x;
  final switch(x){ case foo.bar: return 0; }
}

buggy.d(1): Error: function main.main no return exp; or assert(0); at end of
function

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


[Issue 2814] implicit cast (implemented via alias this) is not triggered when passing to function

2009-08-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2814


Jarrett Billingsley jarrett.billings...@gmail.com changed:

   What|Removed |Added

 CC||jarrett.billings...@gmail.c
   ||om




--- Comment #1 from Jarrett Billingsley jarrett.billings...@gmail.com  
2009-08-05 18:48:39 PDT ---
Strangely, the compiler's behavior differs based on the type of the result of
get().  While the workaround works in this instance (returning Object), it
doesn't seem to work for any other type.  For instance, given this struct:

struct Proxy
{
int get() { return 0; }
alias get this;
}

If you do:

Proxy p;
int x = p;

you get an error saying it can't convert type Proxy to int.  But here's the
real kicker:

Object x = p;

_Now_ the compiler says that it can't convert p.get() of type int to Object! 
So for some reason, it's using the alias this when it shouldn't, and not using
it when it should.

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


[Issue 3176] Compiler hangs on poorly formed mixin in variadic template

2009-08-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3176


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

   What|Removed |Added

   Keywords||patch
Version|2.031   |1.045
Summary|Compiler hangs on poorly|Compiler hangs on poorly
   |formed recurrence function  |formed mixin in variadic
   ||template




--- Comment #3 from Don clugd...@yahoo.com.au  2009-08-05 19:07:57 PDT ---
/*
Actually it's not so complicated as I thought -- it's just that after fixing
this, it falls foul of bug #3196. On D1, this is a complete fix.

PATCH: parse.c, line 2899 in DMD1.046, line 3358 in DMD2.

-while (token.value != TOKrcurly)
+while (token.value != TOKrcurly  token.value != TOKeof)
*/

// Even smaller test case:
void foo(S...)(S u) {
alias typeof(mixin({ return a[1;}()))  z;
}

void main() {
   foo!()(0);
}

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