[Issue 8950] New: postblit not called on const static array initialization

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

   Summary: postblit not called on const static array
initialization
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Keywords: wrong-code
  Severity: major
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: verylonglogin@gmail.com


--- Comment #0 from Denis Shelomovskij verylonglogin@gmail.com 2012-11-03 
10:12:57 MSK ---
---
struct S
{
static int postblits = 0;

this(this) const
{ ++postblits; }
}

void main()
{
auto s = S();

S[2] arr = s;
assert(S.postblits == 2); // ok
S.postblits = 0;

const S[2] constArr = s;
assert(S.postblits == 2); // failed: S.postblits == 0
S.postblits = 0;

const S[2] constArr2 = arr;
assert(S.postblits == 2); // failed: S.postblits == 0
S.postblits = 0;
}
---

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


[Issue 8942] `alias qualifier type` ignores qualifier in foreach over tuple

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


Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

   Keywords||pull, rejects-valid


--- Comment #1 from Kenji Hara k.hara...@gmail.com 2012-11-03 00:17:42 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1253

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


[Issue 8937] import declaration statement without scope after `if` imports to a parent scope

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


Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

   Keywords||pull, rejects-valid


--- Comment #1 from Kenji Hara k.hara...@gmail.com 2012-11-03 00:54:30 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1254

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


[Issue 8951] New: static array of context pointer struct s fails:

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

   Summary: static array of context pointer struct s fails:
   Product: D
   Version: unspecified
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: monarchdo...@gmail.com


--- Comment #0 from monarchdo...@gmail.com 2012-11-03 02:47:13 PDT ---
Creating a static array of structs that have a context pointer is not
supported:

//
import std.stdio;

void main()
{
int a;

struct S
{
~this()
{
writeln(pre ++a);
++a;
writeln(post ++a);
}
}

{
writeln(1);
S stuff;
writeln(2);
}
writeln(3);

{
writeln(4);
S[2] stuff;
writeln(5);
}
writeln(6);
}
//
1
2
pre ++a
post ++a
3

4
5
pre ++a
object.Error: Access Violation
//

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


[Issue 8952] New: nested structs with conext pointers fail

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

   Summary: nested structs with conext pointers fail
   Product: D
   Version: unspecified
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: monarchdo...@gmail.com


--- Comment #0 from monarchdo...@gmail.com 2012-11-03 03:00:20 PDT ---
Nesting a struct with a context pointer into another will fail.
//
import std.stdio;

void main()
{
int a;

struct S
{
void doit()
{
writeln(pre ++a);
++a;
writeln(post ++a);
}
}

static struct SS
{
S s;
}

SS ss;
ss.s.doit();
}
//
pre ++a
object.Error: Access Violation
//

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


[Issue 8951] static array of context pointer struct s fails:

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



--- Comment #1 from monarchdo...@gmail.com 2012-11-03 03:02:18 PDT ---
(In reply to comment #0)
 Creating a static array of structs that have a context pointer is not
 supported:

Simpler example:

import std.stdio;

//
void main()
{
int a;

struct S
{
void doit()
{
writeln(pre ++a);
++a;
writeln(post ++a);
}
}

{
S s;
s.doit;
}

{
S[2] ss;
ss[0].doit;
}
}
//
pre ++a
post ++a
pre ++a
object.Error: Access Violation
//

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


[Issue 8953] New: Parser rejects qualifier after destructor i.e. `~this() qualifier { }`

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

   Summary: Parser rejects qualifier after destructor i.e.
`~this() qualifier { }`
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Keywords: rejects-valid
  Severity: minor
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: verylonglogin@gmail.com


--- Comment #0 from Denis Shelomovskij verylonglogin@gmail.com 2012-11-03 
14:38:17 MSK ---
---
struct S
{
this(int)  const { } // ok
this(this) const { } // ok
~this()const { } // Error: semicolon expected following function
declaration
}
---

Workaround:
put qualifier before destructor:
---
const ~this() { } // ok
---

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


[Issue 8954] New: Missing line number in error message for uncollable destructor/postblit

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

   Summary: Missing line number in error message for uncollable
destructor/postblit
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Keywords: diagnostic
  Severity: critical
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: verylonglogin@gmail.com


--- Comment #0 from Denis Shelomovskij verylonglogin@gmail.com 2012-11-03 
14:50:18 MSK ---
---
struct S
{
this(this) { }
~this() { }
}

struct S2
{ const S s; }
---

Output:
---
Error: destructor main.S.~this () is not callable using argument types () const
Error: function main.S.__postblit () is not callable using argument types ()
const
---

Severity is Critical as Don write in Issue 5314, comment 10:
 They're equivalent to compiler segfaults. Worse than any rejects-valid bug.
 They're nearly always very easy to fix, too. There's no excuse for them.

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


[Issue 8940] Able to modify const/immutable with passing to a templated function by `ref`

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



--- Comment #2 from github-bugzi...@puremagic.com 2012-11-03 05:09:50 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/02c301feaafebe754a5298b60394921e32938148
Supplemental fix for Issue 8940 - Able to modify const/immutable with passing
to a templated function by `ref`

splitUnitsFromHNSecs accepts ref long, so it should not be called with
immutable long.
But' it has been accidentally accepted by issue 8940.

https://github.com/D-Programming-Language/phobos/commit/941b46a0cc12ba6f5633c86f06f3acf3fd448e72
Merge pull request #921 from 9rnsr/fix8940

Supplemental fix for Issue 8940 - Able to modify const/immutable with passing
to a templated function by `ref`

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


[Issue 5314] Wrong error message: struct within immutable member and postblit function

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


Denis Shelomovskij verylonglogin@gmail.com changed:

   What|Removed |Added

 CC||verylonglogin@gmail.com


--- Comment #11 from Denis Shelomovskij verylonglogin@gmail.com 
2012-11-03 15:16:46 MSK ---
Original example compiles fine now but is the issue fixed?

Can somebody familiar with dmd internals check if %s is not mutable error
message gives line now:
https://github.com/D-Programming-Language/dmd/blob/master/src/expression.c



Also example from comment #6 with uncommented `opAssign` new writes this:

main.d(29): ---
main.d(31): ---
constructor: 6
main.d(33): ---
postblit: 7
main.d(35): ---
opAssign: 7
postblit: 7  - added line
main.d(37): ---

The line is added correctly and indicates a fixed compiler bug because

Foo opAssign(const ref Foo other)

returns by value so a temporary is created.

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


[Issue 8940] Able to modify const/immutable with passing to a templated function by `ref`

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


Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

   Keywords||pull


--- Comment #3 from Kenji Hara k.hara...@gmail.com 2012-11-03 05:17:39 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1252

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


[Issue 8926] post-blit copy constructor conflicts with generic opAssign

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


Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||DUPLICATE


--- Comment #1 from Kenji Hara k.hara...@gmail.com 2012-11-03 05:34:12 PDT ---
*** This issue has been marked as a duplicate of issue 4424 ***

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


[Issue 4424] Copy constructor and templated opAssign cannot coexist

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


Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

 CC||malteskaru...@web.de


--- Comment #9 from Kenji Hara k.hara...@gmail.com 2012-11-03 05:34:12 PDT ---
*** Issue 8926 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 8906] attribute inference failure with opAssign and alias this

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


Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

   Keywords||rejects-valid
 Depends on||6356


--- Comment #2 from Kenji Hara k.hara...@gmail.com 2012-11-03 05:45:24 PDT ---
 Works with 2.060. Fails since this commit:
 https://github.com/D-Programming-Language/dmd/commit/9ee798f73a2f7765a68bbe8f40ff292f551dab72

The root cause is bug 6356, and the commit just exposed the issue.

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


[Issue 8955] New: Can't have qualified field with not-qualified constructor/postblit

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

   Summary: Can't have qualified field with not-qualified
constructor/postblit
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Keywords: rejects-valid
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: verylonglogin@gmail.com


--- Comment #0 from Denis Shelomovskij verylonglogin@gmail.com 2012-11-03 
15:55:14 MSK ---
Currently constructor/postblit isn't qualified (see Issue 4338 and Issue 4867).
But it's violated for struct members:

---
struct S
{
this(this) { }
~this() { }
}

struct S2
{ S s; }

const S  globalS;  // ok
const S2 globalS2; // ok

void f()
{
const S  localS;  // ok
const S2 localS2; // ok
}


struct S3 // or class, or union
{ const S s; } // any qualifier causes errors
---


Errors for S with postblit only:
---
Error: function main.S.__postblit () is not callable using argument types ()
const
---


Errors for S with destructor ony (note generated `opAssign`):
---
Error: destructor main.S.~this () is not callable using argument types () const
Error: function main.S.opAssign (S p) is not callable using argument types
(const(S)) const
---


Errors for S with postblit and destructor:
---
Error: destructor main.S.~this () is not callable using argument types () const
Error: function main.S.__postblit () is not callable using argument types ()
const
---


There is no line numbers in errors because of Issue 8954.

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


[Issue 8951] static array of context pointer struct s fails:

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


Maxim Fomin ma...@maxim-fomin.ru changed:

   What|Removed |Added

 CC||ma...@maxim-fomin.ru


--- Comment #2 from Maxim Fomin ma...@maxim-fomin.ru 2012-11-03 06:42:44 PDT 
---
Seems to be issue 8923

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


[Issue 8952] nested structs with conext pointers fail

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


Maxim Fomin ma...@maxim-fomin.ru changed:

   What|Removed |Added

 CC||ma...@maxim-fomin.ru


--- Comment #1 from Maxim Fomin ma...@maxim-fomin.ru 2012-11-03 06:44:51 PDT 
---
And this one is even more closer to issue 8923

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


[Issue 8956] New: Ability to break typesystem with constructor/postblit/destructor (e.g. modify immutable)

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

   Summary: Ability to break typesystem with
constructor/postblit/destructor (e.g. modify
immutable)
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: critical
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: verylonglogin@gmail.com


--- Comment #0 from Denis Shelomovskij verylonglogin@gmail.com 2012-11-03 
16:47:40 MSK ---
As was mentioned in Issue 4338 and Issue 4867 one is able to break typesystem
using postblit/destructor. But that's not all. Constructor also can be used for
this.

Example:
---
int* p1, p2, p3;

struct S
{
int* p;

this(int* p) { p1 = this.p = p; }
this(this)   { p2 = p; }
~this()  { p3 = p; }
}

void main()
{
immutable s = immutable S(new int); // call constructor
{ immutable tmp = s; } // call postblit and destructor
assert(p1 is s.p  p2 is s.p  p3 is s.p);
}
---

The worst is that it can be done accidentally. E.g.:
---
struct S
{
int* p;
this(int* p) { this.p = p; } // Looks really innocuous, isn't it?
}

void main()
{
int i;
immutable s = immutable S(i); // Feel constructor's destructive power!
assert(i is s.p);
}
---


Please, create enhancement requests as other issues and add e.g. `Depends on`
links here.

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


[Issue 4338] Structs with non-const destructors cannot be used as const parameters

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


Denis Shelomovskij verylonglogin@gmail.com changed:

   What|Removed |Added

 CC||verylonglogin@gmail.com


--- Comment #7 from Denis Shelomovskij verylonglogin@gmail.com 2012-11-03 
16:51:43 MSK ---
Consolidated into Issue 8956.

Do not close this issue as a duplicate because it is another issue. E.g. it can
be closed as WONTFIX if destructors will become qualifier-overloadable.

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


[Issue 4867] [GSoC] Postblit is not usable with const objects

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


Denis Shelomovskij verylonglogin@gmail.com changed:

   What|Removed |Added

 CC||verylonglogin@gmail.com


--- Comment #3 from Denis Shelomovskij verylonglogin@gmail.com 2012-11-03 
16:53:04 MSK ---
(In reply to comment #2)
 But, this behavior temporarily allows breaking const correctness inside 
 mutable
 postblit.
 Therefore, I don't close this issue.

Consolidated into Issue 8956.

Do not close this issue as a duplicate because it is another issue. E.g. it can
be closed as WONTFIX if postblits will become qualifier-overloadable.

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


[Issue 6652] foreach parameter with number range is always ref

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



--- Comment #24 from bearophile_h...@eml.cc 2012-11-03 07:06:12 PDT ---
See also:

http://forum.dlang.org/thread/znbtczbgipqqzllaf...@forum.dlang.org

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


[Issue 8946] � any � function does not what it should do

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


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

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||dmitry.o...@gmail.com
 Resolution||INVALID


--- Comment #1 from Dmitry Olshansky dmitry.o...@gmail.com 2012-11-03 
07:18:01 PDT ---
Ever heard of slicing an array in D? 

Check this out: http://dlang.org/d-array-article.html

Dig down in std.algotrithm.find and you'll find out that it's lazy iterates a
forward range. Thus like the most of std.algorithm functions it DOESN'T
allocate. In case of array it just returns a slice of original array.

So this report is invalid.

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


[Issue 8957] New: Closure not recognized when passing type with post-blit as lazy parameter

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

   Summary: Closure not recognized when passing type with
post-blit as lazy parameter
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Keywords: wrong-code
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: c...@klickverbot.at


--- Comment #0 from David Nadlinger c...@klickverbot.at 2012-11-03 07:20:13 
PDT ---
This is a follow-up to the thread �Expression::apply, DeclarationExp and a
possible nested context bug� on dmd-internals:
http://forum.dlang.org/thread/cap9j_hxg8mttnoju9ywyusgzp1nqcdy0+7oehyoq2whnr-d...@mail.gmail.com

The following test case shows that the problem I brought up there there also
leads to wrong-code bugs in DMD (at least I hope it's still the original
problem, I simply extended this from the minimal testcase linked in the
thread):

---
extern(C) void printf(const char*, ...);

struct HasPostblit {
this(this) {};
}

struct Foo {
HasPostblit hp;
int i;
}

void print(Foo f) {
printf(%x\n, f.i);
}

auto toDg(E)(lazy E e) {
return { return e(); };
}

auto getDg() {
Foo a;
a.i = 0x1;
return toDg(print(a));
}

void smashStack() {
int[1024] dummy = 0xcafebabe;
}

void main() {
auto d = getDg();
smashStack();
d();
}
---

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


[Issue 8955] Can't have qualified field with not-qualified constructor/postblit

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



--- Comment #1 from Denis Shelomovskij verylonglogin@gmail.com 2012-11-03 
17:25:18 MSK ---
Partial workaround:

For const/immutable postblit/dtor:
---
struct S
{
private void myPostblit() { }
this(this) inout
{ (cast(S*) this).myPostblit(); }

private void myDtor() { }
~this() inout // Plese `inout` before `~this()` if Issue 8953 unfixed
{ (cast(S*) this).myDtor(); }
}

struct S_ { const S sc; immutable S si; }
---
Note: at least `this(this) inout { }` or `opAssign` is required for dtor

For shared dtor:
---
struct S
{
void opAssign(shared S s) shared { this = s; } // required for dtor

private void myDtor() { }
shared~this()  // Plese `inout` before `~this()` if Issue 8953 unfixed
{ (cast(S*) this).myDtor(); }
}

struct S_ { shared S sc; }
---

Same for constructor except it doesn't require somebody like dtor.

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


[Issue 8956] Ability to break typesystem with constructor/postblit/destructor (e.g. modify immutable)

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


Denis Shelomovskij verylonglogin@gmail.com changed:

   What|Removed |Added

 Depends on||8958


--- Comment #1 from Denis Shelomovskij verylonglogin@gmail.com 2012-11-03 
18:01:11 MSK ---
The first fix proposal: Issue 8958

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


[Issue 8958] New: [RFC] Make constructors/postblits/destructors work correctly with const/immutable qualifiers

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

   Summary: [RFC] Make constructors/postblits/destructors work
correctly with const/immutable qualifiers
   Product: D
   Version: 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 Shelomovskij verylonglogin@gmail.com 2012-11-03 
17:59:49 MSK ---
A proposal to fix Issue 8956 - Ability to break typesystem with
constructor/postblit/destructor


First, lets make them qualifier-overloadable.

Then let we have such struct:
---
class C { }

struct S0
{ int i; immutable int* p; }

struct S1
{ int i; int* p; }

struct S2
{ S1 s1; }

struct S
{
int i;
int* p;
int[] darr;
int[1] sarr;
C c;
S0* pS0;
S1 s1;
S1[1] sarrS1;
S1* pS1;
S2 s2;

this(this) inout // e.g. a postblit
{
// What will we see here?
}
}
---

In an `inout` ctor/postblit/dtor we will see fields as:

* For pointers and dynamic arrays, as a result of `cast()`:
inout(int)* p;
inout(int)[] arr;
inout(S0)* pS0;
inout(S1)* pS1;

* For class references
* require Issue 5325 - Mutable references to const/immutable/shared classes
inout(C)ref c;

* For types where `inout(T)` is assignable to `T` (primitive types, some
structs/unions):
int i;
int[1] i;
S0 s0;

* For all other types (structs/unions):
inout(S1) s1;
inout(S1[1]) sarrS1;
inout(S2) s2;

* But assignment is allowed:
s1 = inout(S1)();
* Assignment by index or property is allowed if it writes to (this)[0 ..
1] memory:
sarrS1[0] = inout(S1)();
s2.s1 = inout(S1)();
s2.s1.i = 5;
* For its fields that are in (this)[0 .. 1] memory same type-replacement
rules apply:
is(typeof(s2.s1.i) == int)


This proposal can be consolidated in some analog of `inout(T)ref` from Issue
5325 but for structs with same syntax and one simple rule: it is mutable if it
is in (this)[0 .. 1] memory.



You are welcome to find mistakes, improve, destroy or make a counter-proposal!

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


[Issue 8959] New: IsExpression should support syntax which has no Identifier in all cases

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

   Summary: IsExpression should support syntax which has no
Identifier in all cases
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: k.hara...@gmail.com


--- Comment #0 from Kenji Hara k.hara...@gmail.com 2012-11-03 09:14:37 PDT ---
From: http://dlang.org/expression#IsExpression
IsExpression now supports following syntax.

1.  is ( Type )
2.  is ( Type :  TypeSpecialization )
3.  is ( Type == TypeSpecialization )
4.  is ( Type Id )
5.  is ( Type Id :  TypeSpecialization )
6.  is ( Type Id == TypeSpecialization )
7a. is ( Type Id :  TypeSpecialization , TemplateParameterList )
7b. is ( Type Id == TypeSpecialization , TemplateParameterList )

When sorted by the presence or absence of Id:
1.  is ( Type )
2.  is ( Type :  TypeSpecialization )
3.  is ( Type == TypeSpecialization )
X.  is ( Type :  TypeSpecialization , TemplateParameterList )  // ?
Y.  is ( Type == TypeSpecialization , TemplateParameterList )  // ?

4.  is ( Type Id )  // 1 + Id
5.  is ( Type Id :  TypeSpecialization )  // 2 + Id
6.  is ( Type Id == TypeSpecialization )  // 3 + Id
7a. is ( Type Id :  TypeSpecialization , TemplateParameterList )  // X + Id
7b. is ( Type Id == TypeSpecialization , TemplateParameterList )  // Y + Id

I think X and Y should be supported from the view of language symmetry.

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


[Issue 8057] std.algorithm.move cannot use for nested struct

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


Denis Shelomovskij verylonglogin@gmail.com changed:

   What|Removed |Added

 CC||verylonglogin@gmail.com


--- Comment #3 from Denis Shelomovskij verylonglogin@gmail.com 2012-11-03 
22:35:32 MSK ---
S's destructor is incorrect, as you always can set `S s = S.init` and the
destructor must process that correctly. Corrected destructor variant:

---
 ~this()
 {
+// Struct always can equal to its `init`  - added
+if(this == S.init) return;- added
 // Access to enclosing scope
 assert(n == 10);// Line11
 }
---

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


[Issue 8067] std.algorithm.move doesn't work for static array of elaborate struct

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


Denis Shelomovskij verylonglogin@gmail.com changed:

   What|Removed |Added

 CC||verylonglogin@gmail.com


--- Comment #1 from Denis Shelomovskij verylonglogin@gmail.com 2012-11-03 
22:50:28 MSK ---
Fixed with all other `move` issues in [provoking]
https://github.com/D-Programming-Language/phobos/pull/923

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


[Issue 8946] « any » function does not what it should do

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



--- Comment #2 from Dimitri Sabadie dimitri.saba...@gmail.com 2012-11-03 
14:09:28 PDT ---
(In reply to comment #1)
 Ever heard of slicing an array in D? 
 
 Check this out: http://dlang.org/d-array-article.html
 
 Dig down in std.algotrithm.find and you'll find out that it's lazy iterates a
 forward range. Thus like the most of std.algorithm functions it DOESN'T
 allocate. In case of array it just returns a slice of original array.
 
 So this report is invalid.

Ok, my argument wasn’t worth it I agree. But, why any would use such a function
where a simple loop and a test will do it? It’s the same argument for not to
use countUntil and check if the index is invalid, it consumes more memory that
we want. any does things we don’t want to IMHO.

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


[Issue 8057] std.algorithm.move cannot use for nested struct

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



--- Comment #4 from Denis Shelomovskij verylonglogin@gmail.com 2012-11-04 
00:13:50 MSK ---
(In reply to comment #3)
 S's destructor is incorrect, as you always can set `S s = S.init`...

And also because of `destroy` existance.

This behavior is fixed in
https://github.com/D-Programming-Language/phobos/pull/923

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


[Issue 8946] « any » function does not what it should do

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



--- Comment #3 from Dmitry Olshansky dmitry.o...@gmail.com 2012-11-03 
14:18:25 PDT ---
 Ok, my argument wasn’t worth it I agree. But, why any would use such a 
 function
where a simple loop and a test will do it?

Because find is a simple loop? To not duplicate code? If you have liner search
then it's obvious (for me) to reuse it for exactly the same task. any basically
gives you a bit less then find/countUntill (bool vs pointer-index) by doing the
same amount of work.

 it consumes more memory that we want. any does things we don’t want to IMHO.

Simply not true. I'm not sure where this 'memory' argument comes from at all.
In fact it saves some code space by not duplicating the same code over again.
At best this could be an enhancement request (or better yet - a pull request)
if there is a soild proof that the resulting code is measurably _faster_.

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


[Issue 8946] « any » function does not what it should do

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



--- Comment #4 from Dimitri Sabadie dimitri.saba...@gmail.com 2012-11-03 
14:35:35 PDT ---
(In reply to comment #3)
  Ok, my argument wasn’t worth it I agree. But, why any would use such a 
  function
 where a simple loop and a test will do it?
 
 Because find is a simple loop? To not duplicate code? If you have liner search
 then it's obvious (for me) to reuse it for exactly the same task. any 
 basically
 gives you a bit less then find/countUntill (bool vs pointer-index) by doing 
 the
 same amount of work.
 
  it consumes more memory that we want. any does things we don’t want to IMHO.
 
 Simply not true. I'm not sure where this 'memory' argument comes from at all.
 In fact it saves some code space by not duplicating the same code over again.
 At best this could be an enhancement request (or better yet - a pull request)
 if there is a soild proof that the resulting code is measurably _faster_.

There’s a popFront() function, so why would it be the correct way to search?
Reusing a « linear search » code is not a point here because we want to _find_
something. countUntil gives us the position of an element, find should give
whether the element is or not in a range. It returns a range: why ? It’s
clearly implementation-related, and we don’t care about that detail. I’ll
propose a pull request because the simple fact there’s « find » and « any » is
not good.

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


[Issue 8926] post-blit copy constructor conflicts with generic opAssign

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



--- Comment #2 from Malte Skarupke malteskaru...@web.de 2012-11-03 14:35:27 
PDT ---
Sorry for posting a duplicate, but that other bug was closed, so obviously I
couldn't find it. Well the bug still exists, but I guess somebody wrote a patch
somewhere and that means that it will be fixed.

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


[Issue 6101] Documentation for dead modules still distributed with DMD

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


Andrej Mitrovic andrej.mitrov...@gmail.com changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |


--- Comment #3 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-11-03 
16:13:03 PDT ---
New dead-module html pages are being distributed in 2.060 zip:

std_gregorian.html
std_date.html
std_contracts.html
std_bind.html

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


[Issue 8946] « any » function does not what it should do

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



--- Comment #6 from Dimitri Sabadie dimitri.saba...@gmail.com 2012-11-03 
16:45:23 PDT ---
(In reply to comment #5)
 (In reply to comment #4)
  ...
  There’s a popFront() function, so why would it be the correct way to search?
  Reusing a « linear search » code is not a point here because we want to 
  _find_
  something. countUntil gives us the position of an element, find should give
  whether the element is or not in a range.
 
 Well, no.
 
  It returns a range: why ?
  ...
 
 Because that is its specification. What is the issue?

The issue is: a function that is designed to « search » for something is
excepted to return a boolean, not top popFront() shit and returns the result
range…

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


[Issue 8946] « any » function does not what it should do

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


Andrej Mitrovic andrej.mitrov...@gmail.com changed:

   What|Removed |Added

 CC||andrej.mitrov...@gmail.com


--- Comment #7 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-11-03 
16:58:47 PDT ---
(In reply to comment #6)
 (In reply to comment #5)
  (In reply to comment #4)
   ...
   There’s a popFront() function, so why would it be the correct way to 
   search?
   Reusing a « linear search » code is not a point here because we want to 
   _find_
   something. countUntil gives us the position of an element, find should 
   give
   whether the element is or not in a range.
  
  Well, no.
  
   It returns a range: why ?
   ...
  
  Because that is its specification. What is the issue?
 
 The issue is: a function that is designed to « search » for something is
 excepted to return a boolean, not top popFront() shit and returns the result
 range…

Then use canFind.

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


[Issue 8946] « any » function does not what it should do

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



--- Comment #8 from timon.g...@gmx.ch 2012-11-03 17:38:29 PDT ---
(In reply to comment #6)
 ...
 
 The issue is: a function that is designed to « search » for something is
 excepted to return a boolean, not top popFront() [...] and returns the result
 range…

Maybe the expectation is flawed? eg. see www.google.com. The service called
'search' delivers more information than just a boolean.

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


[Issue 8946] � any � function does not what it should do

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


Jonathan M Davis jmdavisp...@gmx.com changed:

   What|Removed |Added

 CC||jmdavisp...@gmx.com


--- Comment #9 from Jonathan M Davis jmdavisp...@gmx.com 2012-11-03 18:12:26 
PDT ---
 Then use canFind.

canFind does exactly the same thing.

The _only_ difference between calling find and checking whether the result was
empty rather than duplicating find's implementation inside of canFind or any is
the fact that a range is returned, and since that range is bound to be a
relatively small type (almost always either an array or a struct with just a
handful of member variables), the cost of that return is generally minimal, and
there's a halfway decent chance that a move was involved rather than a copy,
making it that much more efficient.

If there's a measurable difference in efficiency between calling find (and
checking for empty) and reimplementing find inside of canFind or any, then
maybe we'll look at making it so that canFind and any don't call find. But the
overhead of that return is so small (especially in comparison to the algorithm
itself), that I'd be surprised if that ever happened.

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