[Issue 12390] Regression (2.065): has no effect in expression diagnostic regression

2014-03-29 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=12390


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||INVALID


--- Comment #1 from Kenji Hara k.hara...@gmail.com 2014-03-29 00:06:37 PDT ---
This is not a regression. Rather the behavior change was an actual fix of
rejects-valid bug.

(In reply to comment #0)
 DMD 2.065: 
 test.d(7): Error: == has no effect in expression (fun().i == 4)

'fun' is not pure, so essentially its call could have side effect. So the error
message was incorrect in 2.065 and earlier.

 DMD master compiles.

Therefore, current git-head behavior is correct.

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


[Issue 12489] New: std.bitmanip byte swapping routines should be partially instantiable

2014-03-29 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=12489

   Summary: std.bitmanip byte swapping routines should be
partially instantiable
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: andrej.mitrov...@gmail.com


--- Comment #0 from Andrej Mitrovic andrej.mitrov...@gmail.com 2014-03-29 
12:15:14 CET ---
I've had a use case for generic endianness swapping when reading file headers,
and was going to use attributes. For example:

struct Header
{
@Converter!(littleEndianToNative!ushort)
ushort reserved1;
}

Unfortunately this doesn't work because you can't partially instantiate
littleEndianToNative:

Error: template instance littleEndianToNative!ushort does not match template
declaration littleEndianToNative(T, uint n)(ubyte[n] val) if
(canSwapEndianness!T  n == T.sizeof)

It would have to be converted to a template, e.g.:

Before:

-
T littleEndianToNative(T, size_t n)(ubyte[n] val) @safe pure nothrow
-

After:

-
template littleEndianToNative(T)
{
T littleEndianToNative(size_t n)(ubyte[n] val) @safe pure nothrow
{
...
}
}
-

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


[Issue 12489] std.bitmanip byte swapping routines should be partially instantiable

2014-03-29 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=12489



--- Comment #1 from Andrej Mitrovic andrej.mitrov...@gmail.com 2014-03-29 
12:32:30 CET ---
Here's a somewhat generic wrapper workaround:

-
template PartialTempl(alias templ, T...)
{
auto PartialTempl(Args...)(auto ref Args args)
{
return templ!T(args);
}
}
-

Usable as:


-
@Converter!(PartialTempl!(littleEndianToNative, ushort))
ushort reserved1;
-

Of course 'littleEndianToNative' and friends take a ubyte[N], not a ushort, so
in my file loading routine I have to take that into account. But using
attributes is pretty nice.

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


[Issue 12482] Add a standard logging module

2014-03-29 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=12482


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

   What|Removed |Added

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


--- Comment #3 from Andrej Mitrovic andrej.mitrov...@gmail.com 2014-03-29 
12:53:43 CET ---
It's in the review queue. Let's not file duplicate reports:

http://wiki.dlang.org/Review_Queue

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


[Issue 4699] Functions in peer scopes cannot have the same name

2014-03-29 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=4699



--- Comment #3 from Stewart Gordon s...@iname.com 2014-03-29 12:21:31 PDT ---
Because the two functions named f0 are in disjoint scopes, the compiler
shouldn't care about the fact that they have the same name.

I can see a problem in that at the moment the mangled names of the two
functions would clash.  So this is presumably a temporary restriction in the
compiler pending a name mangling scheme that avoids this.

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


[Issue 4699] Functions in peer scopes cannot have the same name

2014-03-29 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=4699



--- Comment #4 from bearophile_h...@eml.cc 2014-03-29 12:25:35 PDT ---
(In reply to comment #3)
 So this is presumably a temporary restriction in the
 compiler pending a name mangling scheme that avoids this.

Walter could answer if this restriction is temporary or not.

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


[Issue 12489] std.bitmanip byte swapping routines should be partially instantiable

2014-03-29 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=12489


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||WONTFIX


--- Comment #2 from Andrej Mitrovic andrej.mitrov...@gmail.com 2014-03-29 
21:01:05 CET ---
(In reply to comment #1)
 Here's a somewhat generic wrapper workaround:
 
 -
 template PartialTempl(alias templ, T...)
 {
 auto PartialTempl(Args...)(auto ref Args args)
 {
 return templ!T(args);
 }
 }
 -

This solves it for me.

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


[Issue 12490] New: No Error: , has no effect Error

2014-03-29 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=12490

   Summary: No Error: , has no effect Error
   Product: D
   Version: D2
  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 2014-03-29 14:34:46 PDT ---
//
5, someFun();
//
1 + 2, someFun();
//

I think these should trigger an error. The LHS clearly does nothing, and the
result is not stored anywhere.

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


[Issue 4851] Three suggestions for std.random

2014-03-29 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=4851



--- Comment #7 from bearophile_h...@eml.cc 2014-03-29 16:13:21 PDT ---
If choice returns a reference you can do:


void knuthShuffle(T)(T[] r) {
foreach_reverse (immutable i, ref ri; r[1 .. $ - 1])
r[0 .. i + 1].choice.swap(ri);
}

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


[Issue 12420] [AA] Can't set associative array with array as key value using key type

2014-03-29 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=12420



--- Comment #1 from Kenji Hara k.hara...@gmail.com 2014-03-29 20:21:09 PDT ---
(In reply to comment #0)
 This code should compile:
 ---
 void main()
 {
 int[char[]] aa;
 aa[new char[1]] = 5; // line 4
 }
 ---
 main.d(4): Error: associative arrays can only be assigned values with 
 immutable
 keys, not char[]
 ---

I agree with the conclusion, the reason in my thought is:

`new char[1]` makes unique data and have no foreign reference, so it can be
implicitly convertible to immutable(char[]). Therefore directly using it in the
index part of the AA element setting will be allowed.

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


[Issue 12420] [AA] Can't set associative array with array as key value using key type

2014-03-29 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=12420


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

   What|Removed |Added

   Keywords||pull


--- Comment #2 from Kenji Hara k.hara...@gmail.com 2014-03-29 20:51:15 PDT ---
https://github.com/D-Programming-Language/dmd/pull/3408

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