[Issue 4008] New: dmd source should contain no tabs and use .cpp file extensions

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

   Summary: dmd source should contain no tabs and use .cpp file
extensions
   Product: D
   Version: future
  Platform: Other
OS/Version: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: nfx...@gmail.com


--- Comment #0 from nfx...@gmail.com 2010-03-26 03:22:47 PDT ---
Rationale:

Right now, the dmd source code contains mixed tabs and spaces for indentation.
You can have endless discussions about whether using tabs for indentation is
ok, but I'm sure almost everybody will agree that MIXING tabs and spaces is a
really, really, really bad idea and causes trouble for most editors, making
writing or applying patches unnecessarily hard. I suggest Walter to
consistently use either tabs or spaces for indentation (spaces would cause the
least trouble for others).

Additionally, the dmd source is full of .c whiles, which, despite their file
extensions, are not C, but C++ sources. This is confusing and leads to trouble
with various tools trying to autodetect the language from the filename. I
suggest using more conventional file extensions. I believe .cpp is most widely
accepted for C++ sources.

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


[Issue 4009] New: OPTLINK ruins the day yet again

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

   Summary: OPTLINK ruins the day yet again
   Product: D
   Version: future
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: regression
  Priority: P2
 Component: Optlink
AssignedTo: nob...@puremagic.com
ReportedBy: nfx...@gmail.com


--- Comment #0 from nfx...@gmail.com 2010-03-26 04:27:51 PDT ---
Compile the following source code with dmd x.d -g

OPTLINK will crash:

Unexpected OPTLINK Termination at EIP=0041338F

EAX=6F733231 EBX=6F733231 ECX= EDX=1D8CC66F
ESI=0033FE7C EDI=1D8CC66F EBP=0033FED4 ESP=0033FD60
First=0042000

(copied by hand)

It doesn't crash without -g. It doesn't crash when you reduce the number of
template instantiations, or reduce the references to instantiated templates
(you can vary these by changing the numbers in the program).

Bug 3870 is probably the same bug, but I can't possibly know (the register
contents are completely different).

The test case works perfectly fine on Linux.

 this is file x.d:
template Tuple(T...) {
alias T Tuple;
}

template Repeat(int count) {
static if (!count) {
alias Tuple!() Repeat;
} else {
alias Tuple!(count-1, Repeat!(count-1)) Repeat;
}
}

void sometemplate(int T)() {
foreach (x; Repeat!(62)) {
sometemplate!(T)();
}
}

void main() {
foreach (x; Repeat!(298)) {
sometemplate!(x)();
}
}

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


[Issue 4010] New: dmd should support linkers other than OPTLINK

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

   Summary: dmd should support linkers other than OPTLINK
   Product: D
   Version: future
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: Optlink
AssignedTo: nob...@puremagic.com
ReportedBy: nfx...@gmail.com


--- Comment #0 from nfx...@gmail.com 2010-03-26 04:34:28 PDT ---
Because of the general instability of OPTLINK, I request that dmd should be
able to generate object files consumable by other linkers. OPTLINK is the only
OMF linker I've found capable to link dmd's output.

Possible targets include the Microsoft linker (supports COFF) or the GNU linker
(supports both COFF and ELF on Windows).

dmd already has an Linux and a MacOSX backend, both with different object file
formats; this can't be a too unrealistic feature request.

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


[Issue 3870] Unexpected OPTLINK Termination at EIP=00403208

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



--- Comment #2 from nfx...@gmail.com 2010-03-26 04:39:30 PDT ---
Possibly the same as bug 4009. See a compileable test case there. But the
register contents (including EIP) are different.

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


[Issue 3951] [CTFE] With a fixed-size array

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


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

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||clugd...@yahoo.com.au
 Resolution||FIXED


--- Comment #1 from Don clugd...@yahoo.com.au 2010-03-26 06:58:17 PDT ---
This was fixed in DMD2.042.

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


[Issue 4008] dmd source should contain no tabs and use .cpp file extensions

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


bearophile_h...@eml.cc changed:

   What|Removed |Added

 CC||bearophile_h...@eml.cc


--- Comment #1 from bearophile_h...@eml.cc 2010-03-26 07:44:34 PDT ---
They are both ideas that I like, but:
- It seems versioning systems are stupid, they are not able to ignore leading
spaces, so replacing tabs with spaces can create a huge diff file, essentially
it's a new version of all files. Yet, if this is the only change then I think
this can be acceptable.
- Walter and others seems to not like cpp file extensions.

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


[Issue 4011] New: Incorrect function overloading using mixins

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

   Summary: Incorrect function overloading using mixins
   Product: D
   Version: unspecified
  Platform: Other
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bugzi...@digitalmars.com


--- Comment #0 from Walter Bright bugzi...@digitalmars.com 2010-03-26 
11:59:08 PDT ---
--- a.d ---
enum FooA { fooA };
void bar(FooA x) {}
--- test.d 
import a;
alias a.bar bar;
mixin(`
enum FooB { fooB };
void bar(FooB x) {}
`);

void test()
{
bar(FooA.fooA);
bar(FooB.fooB); //error
}
--

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


[Issue 4011] Incorrect function overloading using mixins

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



--- Comment #1 from Walter Bright bugzi...@digitalmars.com 2010-03-26 
12:00:55 PDT ---
changeset 420

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


[Issue 4004] DMD 2.042 CTFE regression with functions taking ref parameters

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


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

   What|Removed |Added

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


--- Comment #1 from Don clugd...@yahoo.com.au 2010-03-26 12:09:15 PDT ---
Reduced test case for test suite.

void bug4004a(ref int a) {
assert(a==7);
a+=3;
}

void bug4004b(ref int b) {
b= 7;
bug4004a(b);
}

int bug4004c() {
int offset = 5;
bug4004b(offset);
return offset;
}

static assert(bug4004c()==10);
-
PATCH:

Index: interpret.c
===
--- interpret.c(revision 420)
+++ interpret.c(working copy)
@@ -53,7 +53,7 @@
 Expression *interpret_values(InterState *istate, Expression *earg,
FuncDeclaration *fd);

 ArrayLiteralExp *createBlockDuplicatedArrayLiteral(Type *type, Expression
*elem, size_t dim);
-Expression * resolveReferences(Expression *e, Expression *thisval);
+Expression * resolveReferences(Expression *e, Expression *thisval, bool
*isReference = NULL);

 /*
  * Attempt to interpret a function given the arguments.
@@ -1107,8 +1107,11 @@
 // -
 // The variable used in a dotvar, index, or slice expression,
 // after 'out', 'ref', and 'this' have been removed.
-Expression * resolveReferences(Expression *e, Expression *thisval)
+// *isReference will be set to true if a reference was removed.
+Expression * resolveReferences(Expression *e, Expression *thisval, bool
*isReference /*=NULL */)
 {
+if (isReference)
+*isReference = false;
 for(;;)
 {
 if (e-op == TOKthis)
@@ -1131,6 +1134,8 @@
 VarExp *ve2 = (VarExp *)v-value;
 if (!ve2-var-isSymbolDeclaration())
 {
+if (isReference)
+*isReference = true;
 e = v-value;
 continue;
 }
@@ -2087,7 +2092,8 @@
 v-value = e2;
 return e2;
 }
-e1 = resolveReferences(e1, istate-localThis);
+bool destinationIsReference = false;
+e1 = resolveReferences(e1, istate-localThis, destinationIsReference);

 // Unless we have a simple var assignment, we're
 // only modifying part of the variable.
@@ -2167,7 +2174,8 @@
 {
 VarExp *ve = (VarExp *)e1;
 VarDeclaration *v = ve-var-isVarDeclaration();
-addVarToInterstate(istate, v);
+if (!destinationIsReference)
+addVarToInterstate(istate, v);
 v-value = newval;
 }
 else if (e1-op == TOKindex)

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


[Issue 4012] New: [CTFE][ICE] auto template function, forward reference error

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

   Summary: [CTFE][ICE] auto template function, forward reference
error
   Product: D
   Version: future
  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-26 13:38:27 PDT ---
Problem found with dmd 2.042. This code works at runtime if you move the enum
line inside the main, but as it is crashes the compiler:


struct Searcher(T) {
T[] data;
bool opBinaryRight(string Op:in)(T item) {
return false;
}
}
auto searcher(T)(T[] arr) {
return Searcher!T(arr);
}
enum bool b = 1 in searcher([1]);
void main() {}


Errors printed:
test.d(10): Error: forward reference to inferred return type of function call
searcher([1])
test.d(10): Error: rvalue of in expression must be an associative array, not
int


(Please add the latest dmd2 version to drop-down menu, I don't know how to do
it).

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


[Issue 4012] [CTFE][ICE] auto template function, forward reference error

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


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

   What|Removed |Added

   Keywords||ice-on-invalid-code
 CC||clugd...@yahoo.com.au
Version|future  |2.040
   Severity|normal  |regression


--- Comment #1 from Don clugd...@yahoo.com.au 2010-03-26 17:14:45 PDT ---
This worked in 2.038, failed in 2.040 and later.

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