[Issue 6857] Precondition contract checks should be statically bound.

2012-03-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6857



--- Comment #3 from jens.k.muel...@gmx.de 2012-03-02 00:35:52 PST ---
(In reply to comment #2)
 (In reply to comment #1)
  Can you elaborate why the static type must be considered? What's the problem
  with using the dynamic type?
 
 The problem is simple. Let's consider a class A and a subclass B.
 
 Then a function as this :
 
 void fun(A a) {
 a.foo();
 }
 
 If passed an element of type B, fun will work, because B is a subclass of A. 
 If
 B.foo's contract is different than A.foo's, then B.foo's in contract is
 executed.
 
 It is a bug, because fun has no knowledge weither it manipulate an element of
 type A or an element of type B. It means that fun must respect the in contract
 provided by A.foo, because in other case, it may or may no work, depending on
 how fun in called, which isn't a reliable behavior.

Yesterday I was sleepy and wasn't able to understand it. But even now I fail to
see the issue.
First fun accepts any instance that is of class A or a subclass of A. And
independent of this whenever you call a.foo() all in contracts must be checked
using based on a's dynamic type.

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


[Issue 7626] New: std.regex.match(, r^$) is empty.

2012-03-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7626

   Summary: std.regex.match(, r^$) is empty.
   Product: D
   Version: D2
  Platform: x86
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: kojima...@gmail.com


--- Comment #0 from kojima...@gmail.com 2012-03-02 01:52:50 PST ---
assert(!std.regex.match(, r^$).empty)

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


[Issue 6857] Precondition contract checks should be statically bound.

2012-03-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6857


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

   What|Removed |Added

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


--- Comment #4 from Don clugd...@yahoo.com.au 2012-03-02 01:57:16 PST ---
(In reply to comment #3)
 (In reply to comment #2)
  (In reply to comment #1)
   Can you elaborate why the static type must be considered? What's the 
   problem
   with using the dynamic type?
  
  The problem is simple. Let's consider a class A and a subclass B.
  
  Then a function as this :
  
  void fun(A a) {
  a.foo();
  }
  
  If passed an element of type B, fun will work, because B is a subclass of 
  A. If
  B.foo's contract is different than A.foo's, then B.foo's in contract is
  executed.
  
  It is a bug, because fun has no knowledge weither it manipulate an element 
  of
  type A or an element of type B. It means that fun must respect the in 
  contract
  provided by A.foo, because in other case, it may or may no work, depending 
  on
  how fun in called, which isn't a reliable behavior.
 
 Yesterday I was sleepy and wasn't able to understand it. But even now I fail 
 to
 see the issue.
 First fun accepts any instance that is of class A or a subclass of A. And
 independent of this whenever you call a.foo() all in contracts must be checked
 using based on a's dynamic type.

The point is that fun() must satisfy the precondition for A. The fact that it's
actually receiving a subclass of A is irrelevant.
Since subclasses of A can only widen the precondition, they don't need to be
checked. (Since they must pass A.in(), by definition they will pass A.in() ||
B.in()).

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


[Issue 7627] New: std.traits.isMutable is undocumented

2012-03-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7627

   Summary: std.traits.isMutable is undocumented
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: minor
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: mag...@hetland.org


--- Comment #0 from Magnus Lie Hetland mag...@hetland.org 2012-03-02 02:14:00 
PST ---
As far as I can see, there is no mention of the template isMutable anywhere in
the docs.

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


[Issue 7628] New: Regression with std.string format and alias this

2012-03-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7628

   Summary: Regression with std.string format and alias this
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: ad...@dav1d.de


--- Comment #0 from David ad...@dav1d.de 2012-03-02 06:05:48 PST ---
This code runs on ideone: http://ideone.com/iSBBO 
But not here, 32 bit, Linux, dmd 2.058 with:


/usr/include/d/std/conv.d(101): Error: template
std.format.formatValue(Writer,T,Char) if (is(Unqual!(T) == bool))
formatValue(Writer,T,Char) if (is(Unqual!(T) == bool)) matches more than one
template declaration,
/usr/include/d/std/format.d(1342):formatValue(Writer,T,Char) if
(!isSomeString!(T)  isDynamicArray!(T)) and
/usr/include/d/std/format.d(1978):formatValue(Writer,T,Char) if
(!isSomeString!(T)  (is(T == struct) || is(T == union)))

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


[Issue 7628] Regression with std.string format and alias this

2012-03-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7628


bioinfornatics bioinfornat...@gmail.com changed:

   What|Removed |Added

 CC||bioinfornat...@gmail.com


--- Comment #1 from bioinfornatics bioinfornat...@gmail.com 2012-03-02 
06:07:50 PST ---
I got same error as you on linux 64 with ldc2 and dmdfe 2.058

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


[Issue 7570] Missing error in ctfe for dereferencing a pointer passed as a parameter

2012-03-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7570



--- Comment #2 from Don clugd...@yahoo.com.au 2012-03-02 06:20:59 PST ---
Reduced test case:

bool contains(const char *s) {
return *(s + 0) == 'a';
}
static assert(!contains(froogler));

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


[Issue 7628] Regression with std.string format and alias this

2012-03-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7628



--- Comment #2 from Kenji Hara k.hara...@gmail.com 2012-03-02 06:22:09 PST ---
Don't link to an external site, because it may be disappear in the future.
Instead write code directly, or attach the testcase, please.

 http://ideone.com/iSBBO 

import std.string;
import std.stdio;

struct S {
ubyte[] metadata;

string toString(){
return %s.format( metadata );
}
}

struct Foo {
S[] bar;
alias bar this;

string toString(){
return %s.format( bar );
}
}

void main(){
S   s;
s.metadata = [0,1,2];
Foo foo;
foo.bar = [s];

writeln( foo );
}

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


[Issue 5922] immutable and static variables usage in asm{}

2012-03-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5922


Denis verylonglogin@gmail.com changed:

   What|Removed |Added

 CC||verylonglogin@gmail.com


--- Comment #1 from Denis verylonglogin@gmail.com 2012-03-02 17:37:11 MSK 
---
The first one is definetly a bug with const/immutable local variables:
---
void f() {
const size_t a = 1; // Error: Integer constant expression expected instead
of a = 1u
version (D_InlineAsm_X86_64)
asm { mov RAX, a; }
else version (D_InlineAsm_X86)
asm { mov EAX, a; }
else
static assert(1);
}
---

The second one looks like expected behaviour because with current inline
assembler for non-stack varable `someVar` instruction `mov EAX, someVar;` is
equal to `mov EAX, [someVar];` and `mov EAX, [n];` where `n` is a displacement
of `someVar` from some initial addres which depends on `someVar` type (global,
shared, or TLS).
Inline assembler behaves in this way but I've never seen any documentation and
reasons *why* does it behave this way because it's really unobvious.

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


[Issue 7629] New: Add check for ref/out parameters not being null

2012-03-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7629

   Summary: Add check for ref/out parameters not being null
   Product: D
   Version: D1  D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: verylonglogin@gmail.com


--- Comment #0 from Denis verylonglogin@gmail.com 2012-03-02 17:48:33 MSK 
---
---
void f(ref int i) { }
void g(out int i) { }

void main()
{
int* ptr = null;
f(*ptr); // No RT errors
g(*ptr); // `Access violation` because of a try to write a default value
}
---
Tests for ref/out parameters not being null will be very useful.

Current specs doesn't prohibit null ref/out parameters but it looks
inconsistent. I'd like specs to be changed to prohibit such cases or to clarify
why is it useful (and not prohibited).

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


[Issue 7629] Add check for ref/out parameters not being null

2012-03-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7629



--- Comment #1 from Denis verylonglogin@gmail.com 2012-03-02 18:51:54 MSK 
---
I meant the issue is that if ref null argument isn't used no RT error is
generated, `Access violation` for null out argument isn't perfect but is
acceptable and corresponds to member function call on null object reference.

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


[Issue 7630] New: declaration in switch scope not initialized + CTFE error

2012-03-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7630

   Summary: declaration in switch scope not initialized + CTFE
error
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: d...@dawgfoto.de


--- Comment #0 from d...@dawgfoto.de 2012-03-02 09:47:15 PST ---
int foo(int a)
{
switch (a)
{
int res;
case 1:
res = 1;
return res;
case 2:
return res;

default:
return 0;
}
}

void main()
{
enum v1 = foo(1);// CTFE error, v-addrOnStack not set
enum v2 = foo(2);// CTFE error, used before initialization
assert(foo(2) == 0); // runtime error, res is uninitialized
}



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


[Issue 7618] delegate/function pointer call bypass parameter storage class

2012-03-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7618



--- Comment #2 from github-bugzi...@puremagic.com 2012-03-02 11:39:30 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/40b290c66756bce69369b188cad2cda1f3794777
fix Issue 7618 - delegate/function pointer call bypass parameter storage class

https://github.com/D-Programming-Language/dmd/commit/f2eff281cbb950cf85b47dda943afcbde22964d4
Merge pull request #776 from 9rnsr/fix7618

Issue 7618 - delegate/function pointer call bypass parameter storage class

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


[Issue 7618] delegate/function pointer call bypass parameter storage class

2012-03-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7618


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

   What|Removed |Added

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


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


[Issue 3682] Regression(2.038) is expression fails to match types

2012-03-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3682


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

   What|Removed |Added

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


--- Comment #6 from Walter Bright bugzi...@digitalmars.com 2012-03-02 
12:51:49 PST ---
It works with D2 2.059 head

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


[Issue 7626] std.regex.match(, r^$) is empty.

2012-03-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7626


Nils mailm...@nilsb.dyndns.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||DUPLICATE


--- Comment #1 from Nils mailm...@nilsb.dyndns.org 2012-03-02 14:52:52 PST ---
*** This issue has been marked as a duplicate of issue 7111 ***

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


[Issue 7111] New regex engine cannot match beginning of empty string

2012-03-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7111


Nils mailm...@nilsb.dyndns.org changed:

   What|Removed |Added

 CC||kojima...@gmail.com


--- Comment #3 from Nils mailm...@nilsb.dyndns.org 2012-03-02 14:52:52 PST ---
*** Issue 7626 has been marked as a duplicate of this issue. ***

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


[Issue 7632] New: byValue() for associative arrays doesn't return the correct values

2012-03-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7632

   Summary: byValue() for associative arrays doesn't return the
correct values
   Product: D
   Version: D2
  Platform: x86_64
OS/Version: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: exe...@gmail.com


--- Comment #0 from Erik Johansson Andersson exe...@gmail.com 2012-03-02 
17:50:14 PST ---
This has been tested using the latest git revision.

Test case:

import std.stdio;

void main()
{
int[int] i;
foreach (idx; 0 .. 10)
i[idx] = idx * 2;

writeln(i.byValue()); // output: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
writeln(i.values); // output: [0, 8, 16, 2, 10, 18, 4, 12, 6, 14]
}

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


[Issue 7371] Associative arrays as associative array keys

2012-03-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7371



--- Comment #2 from hst...@quickfur.ath.cx 2012-03-02 19:29:09 PST ---
https://github.com/D-Programming-Language/druntime/pull/171

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


[Issue 6210] Associative array with array key often cannot be equated.

2012-03-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6210


hst...@quickfur.ath.cx changed:

   What|Removed |Added

 CC||hst...@quickfur.ath.cx


--- Comment #1 from hst...@quickfur.ath.cx 2012-03-02 19:29:48 PST ---
https://github.com/D-Programming-Language/druntime/pull/171

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


[Issue 4820] Regression(1.058, 2.044) in DStress caused by changeset 452

2012-03-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4820



--- Comment #4 from github-bugzi...@puremagic.com 2012-03-02 21:28:41 PST ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/06e98272f690cf79444b797d2de021ee7eb4a186
fix Issue 4820 - Regression(1.058, 2.044) in DStress caused by changeset 452

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


[Issue 4820] Regression(1.058, 2.044) in DStress caused by changeset 452

2012-03-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4820



--- Comment #5 from github-bugzi...@puremagic.com 2012-03-02 22:19:06 PST ---
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/415e48ac4703ffab94cd6ce5a3211625099c637a
fix Issue 4820 - Regression(1.058, 2.044) in DStress caused by changeset 452

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


[Issue 4820] Regression(1.058, 2.044) in DStress caused by changeset 452

2012-03-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4820


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

   What|Removed |Added

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


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