[Issue 11161] Document the default struct equality comparison and operator overloading

2013-11-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=11161


Denis Shelomovskij verylonglogin@gmail.com changed:

   What|Removed |Added

   Severity|normal  |major


--- Comment #6 from Denis Shelomovskij verylonglogin@gmail.com 2013-11-05 
11:31:21 MSK ---
(In reply to comment #2)
 1. Find opEquals method from the type of operands
 2. If 'alias this' declaration exists, compiler tries to resolve equality
 operation via alias this. - `t1.value != t2.value` is tested, and succeeds to
 compile.

Just to be clear, currently we have this:
---
struct S
{
int i, j;
alias j this;
}

void main()
{
S s1 = {0}, s2 = {1};
assert(s1 == s2); // ok, resolved as `s1.j == s2.j`
}
---
And I'm quite sure it must be clearly documented.

Also it should be mentioned one have to add:
---
bool opEquals(in typeof(this) other)
{ return this.tupleof == other.tupleof; }
---
if old comparison behavior is needed.

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


[Issue 5999] Runtime treats floating NaNs to be equal

2013-11-05 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=5999


Denis Shelomovskij verylonglogin@gmail.com changed:

   What|Removed |Added

   Keywords||pull
 CC||verylonglogin@gmail.com
 AssignedTo|nob...@puremagic.com|verylonglogin@gmail.com
Summary|Inconsistent equality with  |Runtime treats floating
   |array of NaNs between   |NaNs to be equal
   |runtime and CTFE|
 OS/Version|Mac OS X|All
   Severity|minor   |normal


--- Comment #4 from Denis Shelomovskij verylonglogin@gmail.com 2013-11-05 
12:15:10 MSK ---
https://github.com/D-Programming-Language/druntime/pull/660

Note complex types already work fine.

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


[Issue 11442] New: [CTFE] Bitwise struct comparison don't work for struct with float

2013-11-05 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11442

   Summary: [CTFE] Bitwise struct comparison don't work for struct
with float
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Keywords: CTFE, wrong-code
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: verylonglogin@gmail.com


--- Comment #0 from Denis Shelomovskij verylonglogin@gmail.com 2013-11-05 
12:19:24 MSK ---
---
struct S { float n; }
static assert(S.init is S.init); // fails
---

-- 
Configure issuemail: https://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

2013-11-05 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=3632


Denis Shelomovskij verylonglogin@gmail.com changed:

   What|Removed |Added

 CC||verylonglogin@gmail.com


--- Comment #29 from Denis Shelomovskij verylonglogin@gmail.com 
2013-11-05 12:53:25 MSK ---
So currently we have this:
---
void main()
{
float f1, f2 = float.nan;
assert(f1 !is f2); // ok

import std.math;
assert(NaN(0) !is NaN(1)); // ok
assert(NaN(1) !is NaN(2)); // ok
}

static assert({
float f1, f2 = float.nan;
assert(f1 !is f2); // error, the only failing test
return 1;
}());
---

-- 
Configure issuemail: https://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

2013-11-05 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=3632



--- Comment #30 from Denis Shelomovskij verylonglogin@gmail.com 
2013-11-05 13:02:09 MSK ---
Looks like we have bitwise comparison at runtime, but `f_is` generates some
long assembly code in contrast to `i_is`:
---
bool f_is(float f1, float f2)
{ return f1 is f2; }

bool i_is(int i1, int i2)
{ return i1 is i2; }
---

Can somebody explain what currently does `float is float` do in runtime?

-- 
Configure issuemail: https://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

2013-11-05 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=3632



--- Comment #31 from yebblies yebbl...@gmail.com 2013-11-05 21:20:15 EST ---
(In reply to comment #30)
 Looks like we have bitwise comparison at runtime, but `f_is` generates some
 long assembly code in contrast to `i_is`:
 ---
 bool f_is(float f1, float f2)
 { return f1 is f2; }
 
 bool i_is(int i1, int i2)
 { return i1 is i2; }
 ---
 
 Can somebody explain what currently does `float is float` do in runtime?

Calls memcmp (
https://github.com/D-Programming-Language/dmd/pull/724/files#diff-6e3ab8a500e476994f345ede433811bbR2479
)

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


[Issue 7782] [ICE] With wrong import syntax

2013-11-05 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=7782


bearophile_h...@eml.cc changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |


--- Comment #3 from bearophile_h...@eml.cc 2013-11-05 02:52:45 PST ---
I am seeing an ICE:


import std.algorithm, std.range. std.math;
void main() {}


Dmd 2.064rc1 gives me:

Assertion failure: 'pkg' on line 1120 in file 'module.c'

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


[Issue 11443] New: Misleading error for mismatch overloaded operator if there are immutable members

2013-11-05 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11443

   Summary: Misleading error for mismatch overloaded operator if
there are immutable members
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Keywords: diagnostic
  Severity: major
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: verylonglogin@gmail.com


--- Comment #0 from Denis Shelomovskij verylonglogin@gmail.com 2013-11-05 
16:51:47 MSK ---
---
struct S
{
const int i;
void opOpAssign(string op : +)(int) { }
void opOpAssign(string op : ~)(int) { }
}

void main()
{
S s;
s += ; // Error: cannot modify struct s S with immutable members
s ~= ; // Error: cannot modify struct s S with immutable members
}
---

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


[Issue 11444] New: Better error messages for Phobos ranges used without bang !

2013-11-05 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11444

   Summary: Better error messages for Phobos ranges used without
bang !
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Keywords: diagnostic
  Severity: enhancement
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2013-11-05 07:39:06 PST ---
This is wrong code:


import std.stdio, std.algorithm;
void main() {
123.map(d = d - '0').writeln;
}


dmd 2.064beta gives the error messages:

test.d(3): Error: template std.algorithm.map does not match any function
template declaration. Candidates are:
...\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(398):   
std.algorithm.map(fun...) if (fun.length = 1)
test.d(3): Error: template std.algorithm.map(fun...) if (fun.length = 1)
cannot deduce template function from argument types !()(string, void)


The mistake is in the map, it should be map!(...). Range-based code that uses
map, filter and other similar functions is becoming common, so I suggest to add
some euristics to the D front-end to generate better error messages for common
Phobos templates that are used without the !, something like:

test.d(3): Error: template std.algorithm.map does not match any function
template. Did you miss a !?

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


[Issue 11287] NRVO should remove dtor call completely

2013-11-05 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11287


Denis Shelomovskij verylonglogin@gmail.com changed:

   What|Removed |Added

 CC||verylonglogin@gmail.com


--- Comment #5 from Denis Shelomovskij verylonglogin@gmail.com 2013-11-05 
19:21:57 MSK ---
(In reply to comment #4)
 Yes. std.typecons.scoped requires NRVO in order to implement its own semantic.
 That's why NRVO should be mentioned properly in language spec.

This is Issue 10372.

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


[Issue 11445] New: adding double[string] causes crash

2013-11-05 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11445

   Summary: adding double[string] causes crash
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: dbdavid...@yahoo.com


--- Comment #0 from Daniel Davidson dbdavid...@yahoo.com 2013-11-05 09:09:34 
PST ---
The following causes a crash. Probably not the best idea to call it. Not
finding a merge for associative arrays, my hope was adding them would do it.

import std.stdio;

void main() {
  double[string] a = [ foo : 22.2 ];
  double[string] b = [ bar : 22.2 ];
  writeln(a+b);
}

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


[Issue 10372] Document NRVO is applied in simple cases

2013-11-05 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=10372


Lars T. Kyllingstad bugzi...@kyllingen.net changed:

   What|Removed |Added

 CC||bugzi...@kyllingen.net


--- Comment #1 from Lars T. Kyllingstad bugzi...@kyllingen.net 2013-11-05 
10:31:21 PST ---
Even for cases where NRVO can't be applied, the spec should guarantee that the
returned struct is moved and not copied.  As far as I can tell, move-on-return
can be applied whenever a struct is created on the stack and then returned.

Here's an example of a case where NRVO can't necessarily be applied, but which
should still compile:

  struct S { @disable this(this); }

  S makeS(bool b)
  {
  S s1;
  S s2;
  return b ? s1 : s2;
  }

  void main()
  {
  auto s = makeS(true);
  }

Note that this compiles today, it just needs to be documented in the spec.

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


[Issue 11446] New: GC realloc doesn't ignore non-GC owned pointers

2013-11-05 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11446

   Summary: GC realloc doesn't ignore non-GC owned pointers
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: druntime
AssignedTo: nob...@puremagic.com
ReportedBy: safety0ff.b...@gmail.com


--- Comment #0 from safety0ff.bugz safety0ff.b...@gmail.com 2013-11-05 
10:32:28 PST ---
According to the documentation [1], GC.realloc should do nothing if passed a
non-GC owned pointers.

Currently if passed a non-zero size parameter along with the non-GC pointer it
will allocate new memory and copy the contents.


Discussion thread:
http://forum.dlang.org/thread/qmiayckycycetnumu...@forum.dlang.org

[1] http://dlang.org/phobos/core_memory.html#.GC.realloc

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


[Issue 11447] New: Closure provide bogus values

2013-11-05 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11447

   Summary: Closure provide bogus values
   Product: D
   Version: D2
  Platform: x86_64
OS/Version: Linux
Status: NEW
  Severity: major
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: deadal...@gmail.com


--- Comment #0 from deadalnix deadal...@gmail.com 2013-11-05 11:45:36 PST ---
Created an attachment (id=1287)
Full source code.

Executive summary, full code in the archive attached.

auto instanciateFromResolvedArgs(Location , Template t,
TemplateArgument[] args) {

static Template gladeulfeurah;
gladeulfeurah = t;
string id = args.map!(
({
}, delegate string(identified) {
assert(t is gladeulfeurah, tagazok);
assert(0);
})
).join;
}

Here, assert(t is gladeulfeurah, tagazok) fails, when it should succeeed.
Significant part of SDC test suite fail due to this bug (SDC crashes as a
result).

To compile what is provided in the archive :
make DMD=PATH_TO_DMD_MASTER
Run with :
LD_LIBRARY_PATH=PATH_TO_PHOBOS_MASTER ./fail

The whole source code to trigger the error is 3 source file, so it isn't that
big.

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


[Issue 10372] Document NRVO is applied in simple cases

2013-11-05 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=10372



--- Comment #2 from Denis Shelomovskij verylonglogin@gmail.com 2013-11-05 
22:49:44 MSK ---
(In reply to comment #1)
 ...
   auto s = makeS(true);

Only `makeS` is related to this issue. This code is for Issue 10371.

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


[Issue 11444] Better error messages for Phobos ranges used without bang !

2013-11-05 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11444


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

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||andrej.mitrov...@gmail.com
 Resolution||DUPLICATE


--- Comment #1 from Andrej Mitrovic andrej.mitrov...@gmail.com 2013-11-05 
13:21:53 PST ---
*** This issue has been marked as a duplicate of issue 9179 ***

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


[Issue 11382] Bad closure variable with scoped destruction

2013-11-05 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11382


deadalnix deadal...@gmail.com changed:

   What|Removed |Added

 CC||deadal...@gmail.com


--- Comment #4 from deadalnix deadal...@gmail.com 2013-11-05 16:04:10 PST ---
I used to think that the destruction should be triggered by the GC when
deallocating, but Kenji is right, this should be an error, or RAII will become
quite unreliable.

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


[Issue 11448] New: `dup` calls @system impure code from @safe pure function

2013-11-05 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11448

   Summary: `dup` calls @system impure code from @safe pure
function
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Keywords: accepts-invalid
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: verylonglogin@gmail.com


--- Comment #0 from Denis Shelomovskij verylonglogin@gmail.com 2013-11-06 
09:56:19 MSK ---
As `dup` calls postblit it should be either @system impure or conditionally
@safe pure as suggested in Issue 5700:
---
struct S
{ this(this){} }

void main() @safe pure
{
S[1] s;
s.dup; // should not be allowed
}
---

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