[Issue 3882] Unused result of pure functions

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3882



--- Comment #6 from bearophile_h...@eml.cc 2011-06-25 23:14:11 PDT ---
(In reply to comment #5)

 I added this as a warning because it's fairly onerous now that we have 
 implicit
 purity deduction.

Thank you very much Walter. DMD 2.054 is becoming an interesting release.

In few months the warning will allow us to see _how much_ onerous a similar
error is.

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


[Issue 3632] modify float is float to do a bitwise compare

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3632


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 2011-06-25 
23:20:33 PDT ---
https://github.com/D-Programming-Language/dmd/commit/0d93cf4333df6e167f9027eb1a4b0aa9a940ff19

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


[Issue 6212] regex fails to make matches that include newline

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6212


kenn...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||kenn...@gmail.com
 Resolution||INVALID


--- Comment #1 from kenn...@gmail.com 2011-06-25 23:25:10 PDT ---
The '.' does not match the new line '\n'. This is by design.

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


[Issue 3632] modify float is float to do a bitwise compare

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3632


bearophile_h...@eml.cc changed:

   What|Removed |Added

 CC||bearophile_h...@eml.cc


--- Comment #4 from bearophile_h...@eml.cc 2011-06-26 00:49:51 PDT ---
Do you know what's missing in the list of bug 3981 ?

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


[Issue 4678] Built struct is callable without opCall

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4678



--- Comment #1 from bearophile_h...@eml.cc 2011-06-26 01:00:13 PDT ---
I think there is a pull request with a patch for this bug, do you know what
one?

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


[Issue 6214] New: Don't influence foreach iteration on range

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6214

   Summary: Don't influence foreach iteration on range
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2011-06-26 01:30:18 PDT ---
This is a little Python 2.6 program:


for i in xrange(10):
i += 1
print i,


Its output shows that you are allowed to modify the iteration variable
(contents of the iteration name), but the iteration goes on with no change:
1 2 3 4 5 6 7 8 9 10


Similar code in D using foreach shows a different story:

import std.stdio;
void main() {
foreach (i; 0 .. 10) {
i += 1;
write(i,  );
}
}

The output:
1 3 5 7 9 


In my opinion this is a bit bug-prone because in real code there is some risk
of modifying the iteration variable i by mistake. (Note: here I am not
talking about D for() loops. They are OK, their semantics is transparent
enough. foreach() loops are less transparent and they *look* higher level than
for() loops). I'd like the iteration variable to act as being a copy of the
true loop variable as in Python. If this is a bit bad for foreach performance,
then I'd like the compiler to forbid the mutation of the foreach iteration
variable inside the foreach body.


Currently you can't solve the problem adding a const(int) to the iteration
variable:

import std.stdio;
void main() {
foreach (const(int) i; 0 .. 10) { // line 3
write(i,  );
}
}


DMD 2.053 gives:
test.d(3): Error: variable test.main.i cannot modify const

--

One answer to Caligo:

 This:
 
   foreach(i; 0..10){
 i += 1;
 write(i,  );
   }
 
 is the same as this:
 
   for(int i = 0; i  10; ++i){
 i += 1;
 write(i,  );
   }

The problem is this equivalence is hidden. foreach() loops look higher level
than for loops. So programmers expect this higher level look to be associated
with a higher level semantics too. This is why I think currently they are a bit
bug-prone. Modifying the loop variable of a foreach loop is code smell, if I
see it in code I fix it in some way, using a copy of the loop variable, or I
replace the foreach loop with a for loop. So I'd like the compiler to ignore
or probably better refuse such modifications to the foreach loop variable, if
possible.

---

This idea has generate a long thread. Most people in the thread seem to
generally agree:

http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.Darticle_id=138630
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.Darticle_id=138852

Maybe even Andrei, but I think Walter has not expressed his opinion yet:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.Darticle_id=138718

---

The idea is to align the semantics of foreach(x;a..b) to the semantics of
foreach(x;iota(a,b)), because in my opinion a range like 5..10 has to be seen
as the literal for an immutable thing, just like a single number, so you are
not allowed to skip some of its items. On this see also bug 4603

Some people suggest to allow the mutation of the range iteration variable on
request, adding a ref:
foreach(ref i; 0..10)

---

See also bug 5255

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


[Issue 3632] modify float is float to do a bitwise compare

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3632


kenn...@gmail.com changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 CC||kenn...@gmail.com
 Resolution|FIXED   |


--- Comment #5 from kenn...@gmail.com 2011-06-26 01:37:29 PDT ---
This is *not yet fixed*. The current implementation in DMD


   real_t v1 = e1-toReal();
   real_t v2 = e2-toReal();
   cmp = !memcmp(v1, v2, sizeof(real_t));


will not work, at least on OS X, because while 'real_t' ('long double') is only
a 80-bit floating point number (occupying 10 bytes), with alignment
'sizeof(real_t)' will take 16 bytes. The extra 6 bytes of paddings are often
filled with garbage. This makes even

   4.0 is 4.0

to return 'false'.

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


[Issue 5725] ubyte/ushort infinite foreach loops

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5725



--- Comment #1 from bearophile_h...@eml.cc 2011-06-26 01:54:29 PDT ---
Related. This compiles with no errors, and maybe goes in infinite loop:

import std.stdio;
void main() {
auto array = new int[270];
foreach (ubyte i, ref x; array)
x = i;
writeln(array);
}


If the range of the fixed-sized array is larger than the max number that the
index can represent, then I suggest to raise a compile-time error, just like
this program does:

void main() {
   ubyte x = 270;
}

test.d(2): Error: cannot implicitly convert expression (270) of type int to
ubyte

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


[Issue 6214] Don't influence foreach iteration on range

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6214



--- Comment #1 from bearophile_h...@eml.cc 2011-06-26 02:07:01 PDT ---
This is an older enhancement requst, bug 5306

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


[Issue 5306] Disallow foreach ref on numeric interval

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5306



--- Comment #1 from bearophile_h...@eml.cc 2011-06-26 02:08:07 PDT ---
See a newer proposal bug 6214

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


[Issue 6212] regex fails to make matches that include newline

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6212


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

   What|Removed |Added

 CC||dmitry.o...@gmail.com


--- Comment #2 from Dmitry Olshansky dmitry.o...@gmail.com 2011-06-26 
03:26:05 PDT ---
Technically deep down std.regex there *is* an option to do that, namely
REA.dotmatcheslf option. However it was never exposed in std.regex interface...

So we definitely need to do one of two: expose dot matches lf option or kill
all of it inside implementation to remove junk.

Thoughts?

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


[Issue 5125] Optional function purity/nothrowness

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5125


bearophile_h...@eml.cc changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #4 from bearophile_h...@eml.cc 2011-06-26 05:03:42 PDT ---
Conditional purity of DMD 2.054 makes this enhancement request unnecessary.

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


[Issue 5045] auto type inference for nest function

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5045



--- Comment #2 from bearophile_h...@eml.cc 2011-06-26 05:10:19 PDT ---
In DMD 2.053 the error messages are:

test.d(2): function declaration without return type. (Note that constructors
are always named 'this')
test.d(2): no identifier for declarator foo()

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


[Issue 4911] Bad error messages from attempts to write into read-only File

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4911



--- Comment #2 from bearophile_h...@eml.cc 2011-06-26 05:20:49 PDT ---
In DMD 2.053 this program:

import std.stdio: File;
void foo() {
auto f = File(test.raw, r);
f.write(hello);
}
void bar() {
foo();
}
void main() {
bar();
}

Gives the error message:

std.exception.ErrnoException@std\stdio.d(286): Cannot open file `test.raw' in
mode `r' (No such file or directory)

...\test.d(8): void test.bar()
...\test.d(10): _Dmain



I think this is as good as it gets, unless a function to find the line number
and module name of the precedent stack frame is used at the exception point, so
I close this bug report.

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


[Issue 4911] Bad error messages from attempts to write into read-only File

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4911


bearophile_h...@eml.cc changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


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


[Issue 4786] enum of run-time array length

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4786


bearophile_h...@eml.cc changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #3 from bearophile_h...@eml.cc 2011-06-26 05:25:12 PDT ---
In DMD 2.053 it gives an error message.

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


[Issue 6215] ICE(el.c) DMD segfaults when built on system with XCode 4.2

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6215


Jacob Carlborg d...@me.com changed:

   What|Removed |Added

 CC||d...@me.com


--- Comment #1 from Jacob Carlborg d...@me.com 2011-06-26 08:34:11 PDT ---
GCC is a symlink for LLVM-GCC with XCode 4.1 as well.

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


[Issue 6216] New: Built-in opAssign implicitly defined should call field's opAssign

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6216

   Summary: Built-in opAssign implicitly defined should call
field's opAssign
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: k.hara...@gmail.com


--- Comment #0 from Kenji Hara k.hara...@gmail.com 2011-06-26 10:47:27 PDT ---
Following should compile.

struct X
{
int n;
const void opAssign(const X rhs) {}
}
struct S
{
int n;
const(X) x;
}
void main()
{
S s;
s = s;
}

test.d(14): Error: variable test.main.s cannot modify struct with immutable
members


S has implicitly defined opAssign, but it does not call field x's opAssign.

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


[Issue 6215] ICE(el.c) DMD segfaults when built on system with XCode 4.2

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6215



--- Comment #2 from Robert Clipsham rob...@octarineparrot.com 2011-06-26 
19:33:46 BST ---
The following patch is a workaround, it seems something's going wrong with the
elem recycling system:

diff --git a/src/backend/el.c b/src/backend/el.c
index f5fa66d..9cc34fc 100644
--- a/src/backend/el.c
+++ b/src/backend/el.c
@@ -195,6 +195,7 @@ elem *el_calloc()
 static elem ezero;

 elcount++;
+#if 0
 if (nextfree)
 {   e = nextfree;
 nextfree = e-E1;
@@ -209,6 +210,9 @@ elem *el_calloc()
 eprm_cnt++;
 #endif
 *e = ezero; /* clear it */
+#else
+e = (elem *)mem_fmalloc(sizeof(elem));
+#endif

 #ifdef DEBUG
 e-id = IDelem;

If you print e and *e, *e is NULL, hence the segfault when assigned to.

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


[Issue 5708] [CTFE] Incorrect string constant folding with -inline

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5708


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

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution||FIXED
Summary|Incorrect string constant   |[CTFE] Incorrect string
   |folding with -inline|constant folding with
   ||-inline


--- Comment #15 from Don clugd...@yahoo.com.au 2011-06-26 14:56:40 PDT ---
It was accidentally fixed in this commit:
6072 - [CTFE] Regression(git master): Cannot declare variable inside an 'if'
condition

which actually fixed the treatment of comma expressions in CTFE.

https://github.com/D-Programming-Language/dmd/commit/1bcae90e09f5eb6988fcd6df4309a137c9901084

I'm adding this to the test suite so it stays fixed.

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


[Issue 5415] @Safe functions not working

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5415


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 2011-06-26 
16:26:53 PDT ---
https://github.com/D-Programming-Language/dmd/commit/952795ec69ad7d704c0848bb160521a435749c42

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


[Issue 4132] pointer arithmetic accepted in @safe functions

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4132


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 2011-06-26 
16:27:15 PDT ---
https://github.com/D-Programming-Language/dmd/commit/952795ec69ad7d704c0848bb160521a435749c42

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


[Issue 5088] Cannot cast const(int) to long in @safe function

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5088


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 2011-06-26 
16:27:58 PDT ---
https://github.com/D-Programming-Language/dmd/commit/952795ec69ad7d704c0848bb160521a435749c42

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


[Issue 4885] Uninitialize Pointers Allowed in @safe code

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4885


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 2011-06-26 
16:27:36 PDT ---
https://github.com/D-Programming-Language/dmd/commit/952795ec69ad7d704c0848bb160521a435749c42

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


[Issue 6186] Struct destructor is not called on out parameter

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6186


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

   What|Removed |Added

 CC||bugzi...@digitalmars.com


--- Comment #1 from Walter Bright bugzi...@digitalmars.com 2011-06-26 
17:28:44 PDT ---
I'm unsure what the right fix is for this.

Out variables are supposed to be initialized by the function, not assigned.
Hence, I think uninitialized variables should be passed to them, and it should
be an error to pass a non-default-initialized variable.

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


[Issue 6186] Struct destructor is not called on out parameter

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6186



--- Comment #2 from Walter Bright bugzi...@digitalmars.com 2011-06-26 
17:29:25 PDT ---
See also:

https://github.com/D-Programming-Language/dmd/pull/155

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


[Issue 5676] [CTFE] segfault using tuple containing struct that has opAssign

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5676


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 2011-06-26 
17:30:59 PDT ---
https://github.com/D-Programming-Language/dmd/commit/766ff55baceec3a8d00d23ece02ff4aadc6b9209

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


[Issue 5693] Segfault with address of template struct opCall

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5693


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 2011-06-26 
17:31:37 PDT ---
https://github.com/D-Programming-Language/dmd/commit/766ff55baceec3a8d00d23ece02ff4aadc6b9209

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


[Issue 2553] Private interfaces cause a link error

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2553


coldinfluence...@yahoo.co.jp changed:

   What|Removed |Added

   Priority|P2  |P3
 CC||coldinfluence...@yahoo.co.j
   ||p


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


[Issue 6161] iasm opcode family Jcc use absolute address instead of relative for functions

2011-06-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6161


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 2011-06-26 
21:31:10 PDT ---
https://github.com/D-Programming-Language/dmd/commit/62b6c07f34598c50acb20e7436cbe7291f97d35e

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