[Issue 8682] Can't install DMD 2.060 on OS X 10.6.8

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8682



--- Comment #5 from Jacob Carlborg d...@me.com 2012-10-23 23:29:21 PDT ---
(In reply to comment #4)
 Jacob, I tried the installer and it seemed to work fine. I was able to compile
 and run a D program. It seemed to put the dmd compiler in my /usr/bin
 directory. It did not put rdmd there. Running dmd or /usr/bin/dmd worked
 fine but rdmd and /usr/bin/rdmd did not work.

I guess that rdmd wasn't available when the installer was created.

 Thank you. I am glad to have something that works. Out of curiosity, what did
 you do?

I just built the installer on Mac OS X 10.6. I would guess that means the
installers created on Mac OS X 10.7 or later aren't backwards compatible, or 
there's a missing flag or similar.

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


[Issue 4563] [module system] Error messages for missing package or missing name

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4563



--- Comment #7 from bearophile_h...@eml.cc 2012-10-24 05:09:04 PDT ---
(In reply to comment #6)

 This is the only test-case left to fix in this Issue (the others seem to be
 fixed).

This is the current situation:



// Case#1
import std.bitmanips: bitfields;
void main() {}

test.d(1): Error: module bitmanips is in file 'std\bitmanips.d' which cannot be
read
import path[0] = C:\dmd2\src\phobos\
import path[1] = C:\dmd2\src\druntime\import\
import path[2] = C:\leonardo\d_bugs\
import path[3] = C:\dmd2\windows\bin\..\..\src\phobos
import path[4] = C:\dmd2\windows\bin\..\..\src\druntime\import



// Case#2
import std.bitmanip: bitfield;
void main() {}

test.d(1): Error: module std.bitmanip import 'bitfield' not found, did you mean
'template bitfields(T...)'?



// Case#3
import std.math: foo;
void main() {}

test.d(1): Error: module std.math import 'foo' not found, did you mean
'function fma'?



The Case#1 probably needs a better error message.

The messages in cases #2 and #3 seem acceptable, it's not bad. But they
sub-optimal, in Case#3 this seems better:

test.d(1): Error: name 'foo' not found in module std.math, did you mean
function 'fma'?

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


[Issue 2516] DDoc omits static on templates

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2516


Nick Treleaven ntrel-pub...@yahoo.co.uk changed:

   What|Removed |Added

 CC||ntrel-pub...@yahoo.co.uk


--- Comment #1 from Nick Treleaven ntrel-pub...@yahoo.co.uk 2012-10-24 
05:31:35 PDT ---
Looks like a duplicate of bug #194 (assuming static counts as an attribute).

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


[Issue 8884] New: std.array RefAppender do not works with .ptr

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8884

   Summary: std.array RefAppender do not works with .ptr
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: bioinfornat...@gmail.com


--- Comment #0 from bioinfornatics bioinfornat...@gmail.com 2012-10-24 
05:32:25 PDT ---
it seem RefAppender do not works with .ptr array property


_
This code give: [0, 1, 2, 3, 4, 5, 6, 7] 
---
import std.stdio;
import std.array;

void main(){
size_t[] a =[ 0,1,2,3 ];

auto a2 = appender( a );
a2.put( [4, 5, 6, 7 ] );
writeln( a );
}
_
This code give: 
Error: template std.array.appender does not match any function template
declaration
Error: template std.array.appender cannot deduce template function from
argument types !()(ulong*)
---
import std.stdio;
import std.array;

void main(){
size_t[] a =[ 0,1,2,3 ];

auto a2 = appender( a.ptr );
a2.put( [4, 5, 6, 7 ] );
writeln( a );
}

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


[Issue 4563] [module system] Error messages for missing package or missing name

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4563



--- Comment #8 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-10-24 
06:48:43 PDT ---
(In reply to comment #7)
 test.d(1): Error: module bitmanips is in file 'std\bitmanips.d' which cannot 
 be
 read
 The Case#1 probably needs a better error message.

Yes, it can be: 

test.d(1): Error: module bitmanips not found in package 'std'

However what if the module is not in any package? Example:

import bitmanips; void main() { }

= test.d(1): Error: module bitmanips is in file 'bitmanips.d' which cannot be
read

What should we do here?

 test.d(1): Error: name 'foo' not found in module std.math, did you mean
 function 'fma'?

I would replace 'name' with 'symbol' here.

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


[Issue 8884] std.array RefAppender do not works with .ptr

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8884


bioinfornatics bioinfornat...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||WONTFIX


--- Comment #1 from bioinfornatics bioinfornat...@gmail.com 2012-10-24 
07:08:38 PDT ---
after bernardth explanation i see that is not a but but diferrence between 
and .ptr is a little confusing

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


[Issue 7019] implicit constructors are inconsistently allowed

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7019


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

   What|Removed |Added

   Keywords||pull


--- Comment #9 from Kenji Hara k.hara...@gmail.com 2012-10-24 07:18:58 PDT ---
(In reply to comment #8)
 Consider (assuming A has an int-accepting ctor):
 
 A object = A(1);
 // or
 auto object = A(1);
 
 In here the name of the type being constructed appears in clear, so there's no
 chance for a potential confusion. The code currently works, as it should.
 
 Consider:
 
 A object = 1;
 
 Again the type being constructed appears in clear. The code works in a 
 function
 but not at top level. It is a bug that it doesn't work at top level, because
 the equivalent construct A object = A(1) does.
 
 Now consider: 
 
 void fun(A)  { ... }
 fun(1);
 
 In here there's no explicit mention of A in the call, which makes this case
 qualitatively different from the ones above. Currently the compiler rejects 
 the
 code and I think it does very well so. Implicit conversions on function calls
 is unrecommended in the presence of function overloading, and essentially C++
 made a mistake about it that it has later partially fixed with the explicit
 keyword. We won't repeat that mistake.

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

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


[Issue 3413] DMD makefiles needs improvements

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3413



--- Comment #2 from Leandro Lucarella leandro.lucare...@sociomantic.com 
2012-10-24 07:38:58 PDT ---
(In reply to comment #1)
 Is this patch still relevant today?

The patch, I don't think it will apply, is too old. I still think the makefile
could use some improvements though, and automatic dependencies handling, but I
don't a patch on this regard will be ever accepted because it depends on GCC
and as long as there is no similar solution in the other compilers being used,
the manual dependencies have to be done anyway.

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


[Issue 8885] New: Passing super class' private method as delegate allowed

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8885

   Summary: Passing super class' private method as delegate
allowed
   Product: D
   Version: D1  D2
  Platform: x86
OS/Version: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: gavin.nor...@sociomantic.com


--- Comment #0 from gavin.nor...@sociomantic.com 2012-10-24 07:41:00 PDT ---
a.d
module a;
class A
{
private d ( ) { }
}


b.d
module b;
import a;

class B : A
{
void x ( void delegate ( ) dg ) { dg(); }

void f ( )
{
x(super.d); // Expected to not be allowed to access private method of
A
}
}

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


[Issue 3413] DMD makefiles needs improvements

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3413


Alex R�nne Petersen a...@lycus.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||WONTFIX


--- Comment #3 from Alex R�nne Petersen a...@lycus.org 2012-10-24 16:40:52 
CEST ---
OK, I guess we can close this then. Thanks!

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


[Issue 3413] DMD makefiles needs improvements

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3413



--- Comment #4 from Leandro Lucarella leandro.lucare...@sociomantic.com 
2012-10-24 07:50:49 PDT ---
(In reply to comment #3)
 OK, I guess we can close this then. Thanks!

Well, I'm not sure there are no alternatives in for the non-gcc platforms. Do
you?

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


[Issue 8143] Safe std.conv.to enum conversion

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8143


monarchdo...@gmail.com changed:

   What|Removed |Added

 CC||monarchdo...@gmail.com


--- Comment #3 from monarchdo...@gmail.com 2012-10-24 07:58:55 PDT ---
(In reply to comment #2)
 (In reply to comment #1)
  This will fail internally if conv.to compares members via ==, because of
  floating point comparison semantics.
  
  So the question is, is this going to be a problem? If yes, should we use
  approxEqual for floating point comparisons?
 By far the main purpose of enums is with integral values (ints, uint, chars,
 etc), to be used to enumerate something or as bitfields. Using
 float/double/real enums is supported in D, but it's not common.
 Using approxEqual is suboptimal, using std.math.feqrel is better. but all
 approximate floating point comparisons have their quirks and limits. 
 Backing-in
 one solution is not a good idea.
  Or maybe we should simply ban using
  std.conv on enums that have a floating point base type?
 What about user-defined floating point types, or a double wrapped in a struct
 with an alias this?
 I think refusing conv on built-in floating point types is an acceptable
 solution to avoid most troubles. Other cases like wrapped doubles are left at
 the care of the programmer.

I'd say there is nothing wrong with using floats as enums. It's rare because
it's new (C++ only supported integral up to now). In C++, I've seen integral
based enums used to index arrays which contained the actual payload (floats,
strigns, others). Now we don't have to do this anymore.

The *real* issue (IMO) is only when converting *back* from float to enum, which
(IMO again), is plain too dangerous to realisticly assume we can support.

I'd rather have float-to-enum always fail, personally.

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


[Issue 8143] Safe std.conv.to enum conversion

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8143



--- Comment #4 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-10-24 
08:02:31 PDT ---
Or alternatively require an additional alias parameter for the comparison
function in case of floats?

E.g.

enum EF : float { C = 4.9 }
float f = 4.9;
static bool compFunc(float lhs, float rhs) { ... }
EF en2 = to!(EF, compFunc)(f);

Since conv.to will already do the work necessary to 1) find the matching
member, 2) ensure there's only 1 matching member, I think customization like
this might be friendlier than just rejecting conversion.

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


[Issue 8886] New: [CTFE] a check failure of memory block inclusion

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8886

   Summary: [CTFE] a check failure of memory block inclusion
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Keywords: CTFE
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: k.hara...@gmail.com


--- Comment #0 from Kenji Hara k.hara...@gmail.com 2012-10-24 09:29:15 PDT ---
From the comment at https://github.com/D-Programming-Language/druntime/pull/335
---
version = bug;

bool foo(const(int)[] a, const(int)[] b)
{
  version(bug) {
return a.length 
   b.ptr = a.ptr 
   b.ptr + b.length = a.ptr + a.length;
  } else {
if (a.length  b.length)
{
auto bend = b.ptr + b.length;
auto aend = a.ptr + a.length;
return a.ptr = b.ptr  bend = aend;
}
return false;
  }
}
bool bug1()
{
auto a1 = [1,2,3,4,5];
return foo(a1[0..4], a1[2..4]);
}
bool bug2()
{
auto a1 = [1,2,3,4,5];
auto a2 = [1,2,3,4,5];
return foo(a1[0..4], a2[2..4]);
}
static assert( bug1());
static assert(!bug2());// Fails CTFE when version = bug; defines.
---

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


[Issue 4563] [module system] Error messages for missing package or missing name

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4563



--- Comment #9 from bearophile_h...@eml.cc 2012-10-24 10:13:27 PDT ---
(In reply to comment #8)

 However what if the module is not in any package? Example:
 
 import bitmanips; void main() { }
 
 = test.d(1): Error: module bitmanips is in file 'bitmanips.d' which cannot be
 read
 
 What should we do here?

Instead of writing:

test.d(1): Error: module bitmanips cannot be found in package 'std'.

It omits the last part of the message:

test.d(1): Error: module bitmanips cannot be found.

(Unrelated: do you know why D error messages don't have an ending full stop .
as in correct English?)

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


[Issue 8143] Safe std.conv.to enum conversion

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8143


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

   What|Removed |Added

 AssignedTo|nob...@puremagic.com|andrej.mitrov...@gmail.com


--- Comment #5 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-10-24 
10:13:51 PDT ---
Ok here's a first implementation, let me know if it can be improved before a
pull request is made (the docs will be improved too):

External: http://dpaste.dzfl.pl/ee99ce99
And copied here:

import std.traits;
import std.conv : ConvException, assertThrown;
import std.string;
import std.math;
import std.stdio;

/**
Convert a value that is implicitly convertible to the enum base type
into an Enum value.
If the value does not match any enum member values, or
if it matches more than one member value throw a ConvException.
*/
T toImpl(T, S)(S value)
if (is(T == enum)  is(S : OriginalType!T) 
!isFloatingPoint!(OriginalType!T))
{
T result;
size_t matches;

foreach (Member; EnumMembers!T)
{
if (Member == value)
{
result = Member;
if (++matches  1)
throw new ConvException(format(Value (%s) matches more than
one member value of enum '%s', value, fullyQualifiedName!T));
}
}

if (!matches)
throw new ConvException(format(Value (%s) does not match any member
value of enum '%s', value, fullyQualifiedName!T));

return result;
}

/**
Ditto:

Specialization for Enums that have a floating point base type.
@equal must be a function which takes the enum base type as
its first parameter, the type of @value as its second parameter,
and return true if the two compare equal.
*/
T toImpl(T, alias equal, S)(S value)
if (is(T == enum)  is(S : OriginalType!T) 
isFloatingPoint!(OriginalType!T))
{
T result;
size_t matches;

foreach (Member; EnumMembers!T)
{
if (equal(Member, value))
{
result = Member;
if (++matches  1)
throw new ConvException(format(Value (%s) matches more than
one member value of enum '%s', value, fullyQualifiedName!T));
}
}

if (!matches)
throw new ConvException(format(Value (%s) does not match any member
value of enum '%s', value, fullyQualifiedName!T));

return result;
}

alias toImpl to;

void test()
{
enum En : int { A = 10, B = 20, C = 30, D = 20 }
En en1 = to!En(10);
assert(en1 == En.A);
assertThrown!ConvException(to!En(5));
// matches more than one
assertThrown!ConvException(to!En(20));

static bool equal(float a, float b) { return feqrel(a, b) = 24; }
enum EF : float { C = 4.9 }
float f = 4.9;
EF enf = to!(EF, equal)(f);

enum EF2 : float { A = 4.9, B = 1.0, C = 4.9 }
float f2 = 4.9;
// matches more than one
assertThrown!ConvException(to!(EF2, equal)(f2));
}

void main()
{
test();
}

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


[Issue 8143] Safe std.conv.to enum conversion

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8143


bearophile_h...@eml.cc changed:

   What|Removed |Added

 AssignedTo|andrej.mitrov...@gmail.com  |nob...@puremagic.com


--- Comment #6 from bearophile_h...@eml.cc 2012-10-24 10:19:48 PDT ---
(In reply to comment #4)

 I think customization like
 this might be friendlier than just rejecting conversion.

It also makes the implementation and usage a bit more complex. Ask to other
people (like Andrei) to see what they think. (Here my preference goes to a
simple solution).

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


[Issue 4563] [module system] Error messages for missing package or missing name

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4563



--- Comment #10 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-10-24 
10:21:54 PDT ---
(In reply to comment #9)
 test.d(1): Error: module bitmanips cannot be found.

Ok, I'll implement a pull and see what others think about it.

 (Unrelated: do you know why D error messages don't have an ending full stop 
 .
 as in correct English?)

GCC and DMC don't add a period either. I think it's purely accidental, some
tools do, others don't (and sometimes it's mixed). I don't mind such issues
though. Personally I worry much more about things like this:

void main()
{
void function(int x, int y, float z) funcC;
void function(int x, float y, int z) funcD;
funcC = funcD;
}

Error: cannot implicitly convert expression (funcD) of type void function(int
x, float y, int z) to void function(int x, int y, float z)

It would make it much easier to debug such cases if the error spanned multiple
lines and aligned the types, for example:

Error: cannot implicitly convert expression (funcD) of type 
void function(int x, float y, int z) to 
void function(int x, int y, float z)

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


[Issue 8143] Safe std.conv.to enum conversion

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8143



--- Comment #7 from bearophile_h...@eml.cc 2012-10-24 10:26:36 PDT ---
(In reply to comment #5)
 Ok here's a first implementation, let me know if it can be improved before a
 pull request is made (the docs will be improved too):

One more test case:

En[][] m1 = to!(En[][])([[10, 30], [30, 10]]);


Have you compiled your code with -property -w?

I am seeing some errors:

...\dmd2\src\phobos\std\traits.d(221): Error: not a property test
...\dmd2\src\phobos\std\traits.d(225): Error: not a property test
...\dmd2\src\phobos\std\traits.d(229): Error: not a property test
...\dmd2\src\phobos\std\traits.d(234): Error: not a property test
...\dmd2\src\phobos\std\traits.d(231): Error: template instance
std.traits.fullyQualifiedName!(test) error instantiating
test.d(27):instantiated from here: fullyQualifiedName!(En)
test.d(76):instantiated from here: toImpl!(En,int)
test.d(27): Error: template instance std.traits.fullyQualifiedName!(En) error
instantiating
test.d(76):instantiated from here: toImpl!(En,int)
test.d(26): Error: constructor std.conv.ConvException.this (string s, string fn
= __FILE__, uint ln = cast(uint)__LINE__) is not callable using argument types
(_error_)
test.d(26): Error: constructor std.conv.ConvException.this (string s, string fn
= __FILE__, uint ln = cast(uint)__LINE__) is not callable using argument types
(_error_)
test.d(26): Error: constructor std.conv.ConvException.this (string s, string fn
= __FILE__, uint ln = cast(uint)__LINE__) is not callable using argument types
(_error_)
test.d(26): Error: constructor std.conv.ConvException.this (string s, string fn
= __FILE__, uint ln = cast(uint)__LINE__) is not callable using argument types
(_error_)
test.d(32): Error: constructor std.conv.ConvException.this (string s, string fn
= __FILE__, uint ln = cast(uint)__LINE__) is not callable using argument types
(_error_)
test.d(76): Error: template instance test.toImpl!(En,int) error instantiating

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


[Issue 8143] Safe std.conv.to enum conversion

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8143



--- Comment #8 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-10-24 
10:28:51 PDT ---
(In reply to comment #6)
 (In reply to comment #4)
 
  I think customization like
  this might be friendlier than just rejecting conversion.
 
 It also makes the implementation and usage a bit more complex. Ask to other
 people (like Andrei) to see what they think. (Here my preference goes to a
 simple solution).

It's only complex for the case of floating point conversion. We could by
default set the alias to be a safe floating-point comparison function by
default so the user doesn't have to pass one if he doesn't want to.

There are other to!() implementations that take special arguments, e.g. in
radix conversions an extra argument is passed.

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


[Issue 8143] Safe std.conv.to enum conversion

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8143



--- Comment #9 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-10-24 
10:31:14 PDT ---
(In reply to comment #7)
 One more test case:
 En[][] m1 = to!(En[][])([[10, 30], [30, 10]]);

Ah, haven't thought about arrays. Will fix..

 Have you compiled your code with -property -w?
 I am seeing some errors:

Those seem to be Phobos errors, unrelated to my code.

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


[Issue 8143] Safe std.conv.to enum conversion

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8143



--- Comment #10 from bearophile_h...@eml.cc 2012-10-24 10:36:19 PDT ---
One more test case:

enum En[][] m1 = to!(En[][])([[10, 30], [30, 10]]);

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


[Issue 8886] [CTFE] a check failure of memory block inclusion

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8886


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

   What|Removed |Added

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


--- Comment #1 from Don clugd...@yahoo.com.au 2012-10-24 10:42:30 PDT ---
This behaviour is intentional. The relevant line is:

return a.length 
   b.ptr = a.ptr 
   b.ptr + b.length = a.ptr + a.length;

This means:
return (a.length 
   b.ptr = a.ptr) 
   b.ptr + b.length = a.ptr + a.length;

If the b.ptr  a.ptr, then the first subexpression fails, and because of
short-circuit evaluation, b.ptr + b.length = a.ptr + a.length is never
evaluated.

What you actually want is:

return a.length 
   (b.ptr = a.ptr 
   b.ptr + b.length = a.ptr + a.length);

Now in this particular case, the compiler could recognize e1  e2  e3 but it
won't work in general, I think it makes things unpredictable.

Changing to a diagnostic bug.

I'm so disappointed, I went to a lot of trouble to give a good error message
(even using the variable names you used!), and it seems it's still not clear
enough. Any suggestions?

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


[Issue 8886] [CTFE] a check failure of memory block inclusion

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8886



--- Comment #2 from Don clugd...@yahoo.com.au 2012-10-24 10:57:37 PDT ---
To clarify: When I say it won't work in general, the problem is things like:

a  b  c  d  e  f

If a and b are pointers to the same memory block, then a  b is OK, and this
expression means:
a  b  isInside(c..e, d..f)
but if a and b are different pointers, then it would be:
isInside(a..c, b..d)  e  f
which is OK as long as e and f are in the same memory block.

then there is an explosion of possible cases, and many similar things _still_
aren't handled ( eg, a1  b1  c1  d1  a2  b2  c2  d2, why isn't this
recognized as two isInside operations?)

So the rule is simple: they have to be part of a single  or || expression.

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


[Issue 8143] Safe std.conv.to enum conversion

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8143



--- Comment #11 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-10-24 
10:58:10 PDT ---
http://dpaste.dzfl.pl/f4e35e84

More tests welcome!

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


[Issue 4563] [module system] Error messages for missing package or missing name

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4563



--- Comment #11 from bearophile_h...@eml.cc 2012-10-24 11:10:27 PDT ---
(In reply to comment #10)

 Ok, I'll implement a pull and see what others think about it.

Thank you.


 It would make it much easier to debug such cases if the error spanned multiple
 lines and aligned the types, for example:
 
 Error: cannot implicitly convert expression (funcD) of type 
 void function(int x, float y, int z) to 
 void function(int x, int y, float z)

Better:

Error: cannot implicitly convert expression (funcD) of type:
  void function(int x, float y, int z)
to type:
  void function(int x, int y, float z)

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


[Issue 8882] map, filter, iota and zip in pure (and nothrow) functions

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8882


bioinfornatics bioinfornat...@gmail.com changed:

   What|Removed |Added

 CC||bioinfornat...@gmail.com


--- Comment #1 from bioinfornatics bioinfornat...@gmail.com 2012-10-24 
11:16:25 PDT ---
*** Issue 8879 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 4563] [module system] Error messages for missing package or missing name

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4563



--- Comment #13 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-10-24 
11:19:11 PDT ---
(In reply to comment #11)
 (In reply to comment #10)
 
  Ok, I'll implement a pull and see what others think about it.
 
 Thank you.

I think we can do even better:

import foo.bar.doo;

Now it's
test.d(3): Error: module doo is in file 'foo\bar\doo.d' which cannot be read

If 'foo' doesn't exist the error should probably be:
test.d(3): Error: package 'foo' not found

If 'bar' doesn't exist it should be:
test.d(3): Error: package 'bar' not found in package 'foo'

If 'doo' doesn't exist:
test.d(3): Error: module 'doo' not found in package 'foo.bar'

Also, we might consider doing informative spellchecker errors, e.g.:

import std.stddio;
test.d(3): Error: module 'stddio' not found in package 'std', did you mean
'stdio'?

The above should probably try finding D modules that are similar to 'stddio',
read their module declaration (because it might be different from the
filename), and if the module declaration is similar to 'stddio' it should print
that module name as a recommendation.

import stdd.stdio;
test.d(3): Error: package 'stdd' not found, did you mean 'std'?

Here we might try finding non-empty folders with .d or .di files named
similarly to 'stdd' and recommend such a folder.

I don't know how hard this will be but I think it's worth pursuing.

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


[Issue 4563] [module system] Error messages for missing package or missing name

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4563



--- Comment #12 from bearophile_h...@eml.cc 2012-10-24 11:17:33 PDT ---
(In reply to comment #10)

  test.d(1): Error: module bitmanips cannot be found.
 
 Ok, I'll implement a pull and see what others think about it.

Or:

test.d(1): Error: module 'bitmanips' cannot be found.

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


[Issue 8879] std.range function should to be usable in a pure (and sometimes nothrow) situations

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8879


bioinfornatics bioinfornat...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||DUPLICATE


--- Comment #1 from bioinfornatics bioinfornat...@gmail.com 2012-10-24 
11:16:24 PDT ---
*** This issue has been marked as a duplicate of issue 8882 ***

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


[Issue 3789] Structs members that require non-bitwise comparison not correctly compared

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3789


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

   What|Removed |Added

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


--- Comment #19 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-10-24 
12:36:15 PDT ---
(In reply to comment #18)
 For the rare cases where you actually *need*
 bitwise comparison on arrays or floats, you can define a special opEquals.

Also hashes suffer from this problem as well. They're compared via 'is' instead
of '==' in struct fields, just like arrays.

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


[Issue 8887] New: static arrays should not be passed by value in extern C/C++ functions

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8887

   Summary: static arrays should not be passed by value in extern
C/C++ functions
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: andrej.mitrov...@gmail.com
ReportedBy: andrej.mitrov...@gmail.com


--- Comment #0 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-10-24 
13:01:56 PDT ---
extern(C) void fail(int[4] x);
extern(C) int[4] fail2();
extern(C++) void fail3(int[4] x);
extern(C++) int[4] fail4();

These should fail since C/C++ compilers always pass arrays by pointer to first
element.

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


[Issue 3789] Structs members that require non-bitwise comparison not correctly compared

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3789


jens.k.muel...@gmx.de changed:

   What|Removed |Added

 CC||jens.k.muel...@gmx.de


--- Comment #20 from jens.k.muel...@gmx.de 2012-10-24 14:18:31 PDT ---
(In reply to comment #1)
 Arrays don't have a an opEquals overloaded operator. What's the bug?

I don't understand.
How can arrays have no opEquals yet this

assert(bar.data == foo.data);

compiles?
Syntactically there is opEquals and it checks whether each element is equal to
the corresponding other element.

And the opEquals generated by default should for each member call opEquals if
it exists. Otherwise it falls back to bit-wise equality.
Why should it be different from this?

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


[Issue 3413] DMD makefiles needs improvements

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3413



--- Comment #5 from Alex R�nne Petersen a...@lycus.org 2012-10-24 23:23:26 
CEST ---
I'm fairly certain there is no other way. I've been involved with some C
projects where the build systems were maintained in very rigorous ways, and
even they couldn't find an alternative to relying on the compiler for this.

It would of course be nice if someone came up with a portable alternative I
haven't thought of, but I doubt it's going to happen...

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


[Issue 8143] Safe std.conv.to enum conversion

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8143



--- Comment #12 from bearophile_h...@eml.cc 2012-10-24 17:20:39 PDT ---
(In reply to comment #11)
 http://dpaste.dzfl.pl/f4e35e84

Please attach this in Bugzilla :-)


 More tests welcome!

Is this supported?

enum En[][] m1 = to!(En[][])([[10, 30], [30, 10]]);

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


[Issue 8143] Safe std.conv.to enum conversion

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8143



--- Comment #13 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-10-24 
17:32:54 PDT ---
Created an attachment (id=1153)
d

(In reply to comment #12)
 Is this supported?
 enum En[][] m1 = to!(En[][])([[10, 30], [30, 10]]);

Yes.

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


[Issue 8143] Safe std.conv.to enum conversion

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8143



--- Comment #14 from bearophile_h...@eml.cc 2012-10-24 17:43:17 PDT ---
(In reply to comment #13)

  Is this supported?
  enum En[][] m1 = to!(En[][])([[10, 30], [30, 10]]);
 
 Yes.

Then I suggest to add it to your tests, because it's not present.

Your tests contain code like:

En[][] m1 = to!(En[][])([[10, 30], [30, 10]]);

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


[Issue 8143] Safe std.conv.to enum conversion

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8143


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

   What|Removed |Added

   Attachment #1153|0   |1
is obsolete||


--- Comment #15 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-10-24 
17:56:41 PDT ---
Created an attachment (id=1154)
code

(In reply to comment #14)
 (In reply to comment #13)
 
   Is this supported?
   enum En[][] m1 = to!(En[][])([[10, 30], [30, 10]]);
  
  Yes.
 
 Then I suggest to add it to your tests, because it's not present.
 
 Your tests contain code like:
 
 En[][] m1 = to!(En[][])([[10, 30], [30, 10]]);

Ah it took me a while to realize you were looking for CTFE ability.

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


[Issue 8143] Safe std.conv.to enum conversion

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8143



--- Comment #16 from bearophile_h...@eml.cc 2012-10-24 18:38:41 PDT ---
(In reply to comment #15)

 Ah it took me a while to realize you were looking for CTFE ability.

Sorry for not being more clear.

Another significant test case, this is useful in many simulations and games, to
write safe tables and start conditions:


enum Code : char { A='A', B='B', C='C' }

void test()
{
...
const code = to!(Code[][])([ABCCBA, BBAA]);
with (Code)
assert(code == [[A, B, C, C, B, A], [B, B, A, A]]);
}


The main problem with this is that you receive conversion errors only at
run-time, and in D the problem with array compile-time constants is that the
compiler re-creates them every time where you use them. So they are not so
useful.

--

Unfortunately this is not yet allowed because to!() is not pure:

immutable code = to!(Code[][])([ABCCBA, BBAA]);

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


[Issue 8888] New: char enums inside functions

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=

   Summary: char enums inside functions
   Product: D
   Version: D2
  Platform: x86
OS/Version: Windows
Status: NEW
  Keywords: rejects-valid
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2012-10-24 18:49:12 PDT ---
If I try to define the char enum inside the function I receive error messages
from the compiler and the linker (DMD 2.061alpha):

---

void main() {
enum Code : char { A='A', B='B', C='C' }
auto arr = [Code.A, Code.B];
}


OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
test.obj(test) 
 Error 42: Symbol Undefined _Dmain4Code6__initZ

---

void main() {
enum Code : char { A='A', B='B', C='C' }
auto arr = [Code.A, Code.B];
}

test.d(2): Error: no identifier for declarator Code
test.d(2): Error: semicolon expected, not ':'
test.d(2): Error: found ':' instead of statement
test.d(4): Error: unrecognized declaration

---

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


[Issue 8143] Safe std.conv.to enum conversion

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8143


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

   What|Removed |Added

   Attachment #1154|0   |1
is obsolete||


--- Comment #17 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-10-24 
18:49:26 PDT ---
Created an attachment (id=1155)
new

Without purity it works ok though.

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


[Issue 8889] New: [2.061 beta][64-bit] Assertion Failure argtypes.c

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8889

   Summary: [2.061 beta][64-bit] Assertion Failure argtypes.c
   Product: D
   Version: D2
  Platform: All
OS/Version: Windows
Status: NEW
  Severity: major
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: dsim...@yahoo.com


--- Comment #0 from David Simcha dsim...@yahoo.com 2012-10-24 19:20:51 PDT ---
struct Foo {
real f;
int i;
}

D:\testdmd -m64 -c test.d
Assertion failure: 't2 || off2 == 8' on line 373 in file 'argtypes.c'

abnormal program termination

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


[Issue 8890] New: std.algorithm.commonPrefix does not handle unicode correctly

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8890

   Summary: std.algorithm.commonPrefix does not handle unicode
correctly
   Product: D
   Version: unspecified
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: jmdavisp...@gmx.com


--- Comment #0 from Jonathan M Davis jmdavisp...@gmx.com 2012-10-24 21:31:11 
PDT ---
This code asserts:

import std.algorithm;

void main()
{
assert(commonPrefix(Пиво, Пони)== П);
}

This is because a portion of the code point following 'П' is returned, because
the code units at the beginning of the next code point match, and commonPrefix
fails to take that possibility into account. It basically operates on code
units right now for matching string types rather than operating on code points
as it should.

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


[Issue 8890] std.algorithm.commonPrefix does not handle unicode correctly

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8890



--- Comment #1 from Jonathan M Davis jmdavisp...@gmx.com 2012-10-24 22:37:26 
PDT ---
https://github.com/D-Programming-Language/phobos/pull/889

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


[Issue 8891] New: non-static opCall runs in initialization incorrectly

2012-10-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8891

   Summary: non-static opCall runs in initialization incorrectly
   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: k.hara...@gmail.com


--- Comment #0 from Kenji Hara k.hara...@gmail.com 2012-10-24 22:41:21 PDT ---
import core.stdc.stdio : printf;
struct S
{
int value = 10;
S opCall(int n) // non-static
{
printf(this.value = %d\n, this.value);// prints garbage!
S s;
s.value = n;
return s;
}
}
void main()
{
S s = 10;   // calls instance opCall incorrectly
}

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