[Issue 5015] New: Cyclic import breaks is() in a static if

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5015

   Summary: Cyclic import breaks is() in a static if
   Product: D
   Version: D1
  Platform: All
OS/Version: Linux
Status: NEW
  Severity: regression
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: nyphb...@gmail.com


--- Comment #0 from William Moore  2010-10-07 17:15:11 PDT 
---
This issue is nearly identical to Issue 4692 with a minor amount of added
depth.  The test case below breaks 1.064 (but not 2.049):

module breaker;
import breaker;

void main() {}

static if (is(ElemType!(int))){}

template ElemType(T) {
  alias _ElemType!(T).type ElemType;
}

template _ElemType(T) {
alias r type;
}

As before, this was distilled from the same multi-module cyclic import.  Also
as before, commenting out the cyclic import causes the code to compile as
expected.  This code works properly in 1.060.

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


[Issue 4985] A missing length problem in typecons.Tuple

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4985


Shin Fujishiro  changed:

   What|Removed |Added

 CC||rsi...@gmail.com


--- Comment #1 from Shin Fujishiro  2010-10-07 16:07:28 PDT 
---
Maybe you updated only your std.typecons to the svn trunk and not
std.typetuple?  I can't reproduce the reported error unless I roll
std.typetuple back.  Please try updating your std.typetuple.

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


[Issue 5014] New: is(T U == super) returns non-shared parent types for shared(T)

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5014

   Summary: is(T U == super) returns non-shared parent types for
shared(T)
   Product: D
   Version: D2
  Platform: Other
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: s...@invisibleduck.org


--- Comment #0 from Sean Kelly  2010-10-07 15:16:56 PDT 
---
The following code:

import std.stdio;
import std.traits;

template Bases(T)
{
static if(is(T U == super))
alias U Bases;
else
static assert(false);
}

void main()
{
alias Bases!(shared(Exception)) bases;
foreach(i, e; bases)
writeln(bases[i].stringof);
}

Prints "Throwable" when it should probably print "shared(Throwable)".

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



[Issue 5013] std.typecons.Tuple should have constructor for static arrays

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5013



--- Comment #1 from Tomasz Sowiński  2010-10-07 13:58:25 
PDT ---
(In reply to comment #0)

> This leaves the reverse conversion unimplementable. A way out can be:
> 
> Tuple!(int, int) t;
> auto ints = to!(int[2])(t);

Or:

auto ints = cast(int[2]) t;

Seems more appropriate as no conversion takes place.

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


[Issue 5013] New: std.typecons.Tuple should have constructor for static arrays

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5013

   Summary: std.typecons.Tuple should have constructor for static
arrays
   Product: D
   Version: D1 & D2
  Platform: Other
OS/Version: All
Status: ASSIGNED
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: and...@metalanguage.com
ReportedBy: tomeks...@gmail.com


--- Comment #0 from Tomasz Sowiński  2010-10-07 13:53:09 
PDT ---
Should work:

int[2] ints;
Tuple!(int, int) t = ints;

This leaves the reverse conversion unimplementable. A way out can be:

Tuple!(int, int) t;
auto ints = to!(int[2])(t);

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


[Issue 4582] distinct field names constraint for std.typecons.Tuple

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4582



--- Comment #2 from bearophile_h...@eml.cc 2010-10-07 13:25:43 PDT ---
Thank you. But I think some tests/benchmarks may be done to make sure this
extra test doesn't slow down too much the compilation of programs that define
many tuple types.

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


[Issue 4666] Optional name for std.typecons.Tuples?

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4666



--- Comment #2 from bearophile_h...@eml.cc 2010-10-07 13:23:09 PDT ---
(In reply to comment #1)
> Hm. Fair point, though I fear it could create more confusion than convenience.

This was just a suggestion, it's not an important thing.

If Tuples get more compiler support and become more like structural types, then
the optional name is able to turn them back again into nominal typing (if their
name differs, they need to be considered different types, even if everything
else is the same).


> After all anyone can define a function that prints the tuple however they 
> want.

This is surprisingly uncommon in Python (and I think in D too). When you need a
special printing function you quite probably prefer to define a struct with
opString instead a free function that accepts a tuple of a certain type.

This means that default printing of tuples needs to be good.

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


[Issue 5012] New: Internal error: handling a nested function in inline asm.

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5012

   Summary: Internal error: handling a nested function in inline
asm.
   Product: D
   Version: D1 & D2
  Platform: Other
OS/Version: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: ibuc...@ubuntu.com


--- Comment #0 from Iain Buclaw  2010-10-07 12:23:22 PDT ---
eg:

int foo()
{
int bar() {}
asm {
mov EAX, bar;
}
}

Throws an 'Internal error: backend/cod3.c 4519'

Whereas if bar() were global, it would compile just fine.

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


[Issue 5011] New: std.container: SList linearRemove produces wrong results

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5011

   Summary: std.container: SList linearRemove produces wrong
results
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: johannesp...@gmail.com


--- Comment #0 from Johannes Pfau  2010-10-07 10:32:11 
PDT ---
If the first element of the Range passed to linearRemove(Take!Range r) is the
SList root element all elements of Range are removed, not only the elements of
Take!Range.

Test case:

import std.container;
import std.range;
void main()
{
auto s = SList!int(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
auto r = s[];
auto r1 = take(r, 4);
assert(equal(r1, [1, 2, 3, 4]));
auto r2 = s.linearRemove(r1);
assert(s == SList!int(5, 6, 7, 8, 9, 10)); //fails
}

Solution:
In the linearRemove(Take!Range r) function
Range linearRemove(Take!Range r)
{
auto orig = r.original;
// We have something to remove here
if (orig._head == _root)
{
// remove straight from the head of the list
for (; !orig.empty; orig.popFront())

The for line needs to be changed to:
for (; !r.empty; r.popFront())

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


[Issue 4577] Third way to create a std.typecons.Tuple

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4577


Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC||and...@metalanguage.com
 AssignedTo|nob...@puremagic.com|and...@metalanguage.com


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


[Issue 4582] distinct field names constraint for std.typecons.Tuple

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4582


Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC||and...@metalanguage.com
 AssignedTo|nob...@puremagic.com|and...@metalanguage.com


--- Comment #1 from Andrei Alexandrescu  2010-10-07 
08:02:31 PDT ---
Excellent.

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


[Issue 4666] Optional name for std.typecons.Tuples?

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4666


Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC||and...@metalanguage.com
 AssignedTo|nob...@puremagic.com|and...@metalanguage.com


--- Comment #1 from Andrei Alexandrescu  2010-10-07 
08:00:27 PDT ---
Hm. Fair point, though I fear it could create more confusion than convenience.
After all anyone can define a function that prints the tuple however they want.

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


[Issue 4591] Concat of std.typecons.Tuples

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4591


Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC||and...@metalanguage.com
 AssignedTo|nob...@puremagic.com|and...@metalanguage.com


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


[Issue 4846] A problem with array of std.typecons.Tuple

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4846


Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC||and...@metalanguage.com
 AssignedTo|nob...@puremagic.com|and...@metalanguage.com


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


[Issue 5005] Remove restrictions on module/package with same name.

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5005



--- Comment #5 from Austin Hastings  2010-10-07 07:44:01 
PDT ---
Nick,

Your understanding is correct. I want to be able to hide the implementation of
the module/package from users of the module/package, by keeping the same name.

Your suggestion, however, fails in real life. The problem with the _impl
approach (which is *exactly* - down to the spelling - what I tried first) is
that it fails for any kind of complex structure, where more than one _impl is
required.

 example 
lib.mylib.sublib.foo

becomes

lib.mylib_impl.sublib_impl.foo

and has to import

lib.mylib_impl.something

and 

lib.mylib_impl.sublib_impl.otherthing

==

The approach suggested by bearophile is (pardon the pun) bearable, since it
permits the internal parts to maintain their correct names at the cost of
having to change the caller code.

This is the "worse" solution in terms of making the use of the library opaque,
but the "better" solution in terms of making it possible to manipulate the
source code with a "dumb" script: 

perl -pi.bak -e "s/lib.mylib;/lib.mylib.all;/" $file

(The fact that I have to manipulate the code with a dumb shell script is
evidence to me of why this is a good enhancement. :)

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


[Issue 2485] non-static initialization of struct using static initializer syntax generates wrong code

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2485


Don  changed:

   What|Removed |Added

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


--- Comment #1 from Don  2010-10-07 07:35:43 PDT ---
*** Issue 4552 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 4552] Struct initialization results in struct member garbage values

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4552


Don  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||clugd...@yahoo.com.au
 Resolution||DUPLICATE


--- Comment #1 from Don  2010-10-07 07:35:43 PDT ---
*** This issue has been marked as a duplicate of issue 2485 ***

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


[Issue 4914] Assertion failure: 'pr != PREC_zero' on line 817 in file 'expression.c'

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4914


Don  changed:

   What|Removed |Added

   Keywords||ice-on-invalid-code
 Status|NEW |RESOLVED
 CC||clugd...@yahoo.com.au
 Resolution||DUPLICATE
   Severity|normal  |regression


--- Comment #1 from Don  2010-10-07 07:26:31 PDT ---
*** This issue has been marked as a duplicate of issue 4926 ***

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


[Issue 4926] ICE: PREC_zero assertion failure due to unset precedence

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4926


Don  changed:

   What|Removed |Added

 CC||ah0801...@yahoo.com


--- Comment #6 from Don  2010-10-07 07:26:31 PDT ---
*** Issue 4914 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 4926] ICE: PREC_zero assertion failure due to unset precedence

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4926


Don  changed:

   What|Removed |Added

 CC||2kor...@gmail.com


--- Comment #5 from Don  2010-10-07 07:25:11 PDT ---
*** Issue 4981 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 4981] Assertion failure: 'precedence[e->op] != PREC_zero' on line 816 in file 'expression.c'

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4981


Don  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||clugd...@yahoo.com.au
 Resolution||DUPLICATE


--- Comment #1 from Don  2010-10-07 07:25:11 PDT ---
The ICE is a duplicate of bug 4926. You're also seeing a poor error message:
I've created bug 5010 for that.

*** This issue has been marked as a duplicate of issue 4926 ***

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


[Issue 5010] New: Error messages for properties could be improved

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5010

   Summary: Error messages for properties could be improved
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: diagnostic
  Severity: minor
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don  2010-10-07 07:22:52 PDT ---
The problem with the error messages is that they refer to the property in the
syntax it has AFTER conversion to a function call.


CASE 1: Assignments cannot be chained through properties

@property
void prop(int x) {}

void main()
{
   int a = prop = 6;
}

bug.d(7): Error: expression prop(6) is void and has no value


The error message is quite difficult to understand. I do think it is quite
reasonable that it fails to compile, though, since the getter could be defined
as:

@property
int prop() { return 2; }

Secondly, the error messages when you use a getter (eg, int a = prop; ), when
only a setter is defined, are:

bug.d(7): Error: function test0.prop (int x) is not callable using argument
types ()
bug.d(8): Error: expected 1 function arguments, not 0
bug.d(9): Error: expression prop() is void and has no value

This error message is confusing because no parens were used.

The same situation applies when trying to use a setter, when only a getter is
defined.

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


[Issue 1001] print stack trace (in debug mode) when program die

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1001


Benjamin Thaut  changed:

   What|Removed |Added

 CC||c...@benjamin-thaut.de


--- Comment #33 from Benjamin Thaut  2010-10-07 
06:39:34 PDT ---
For a win32 stacktrace (XP+) you might check my project on this:

http://3d.benjamin-thaut.de/?p=15

Kind Regards
Benjamin Thaut

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


Re: [Issue 5006] 'pure' unenforced in a nested function

2010-10-07 Thread Don

d-bugm...@puremagic.com wrote:

http://d.puremagic.com/issues/show_bug.cgi?id=5006


Stewart Gordon  changed:

   What|Removed |Added

   Keywords||accepts-invalid
 CC||s...@iname.com


--- Comment #1 from Stewart Gordon  2010-10-07 04:33:04 PDT ---
Please remember to assign keywords to bug reports.  To everybody reading this:
Please look through issues you've reported and check for missing keywords.


Thanks Stewart. There are currently 395 bugs with no keywords!!
I use keywords in most of my searches, so bugs without keywords tend to 
get overlooked.


[Issue 5006] 'pure' unenforced in a nested function

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5006


Stewart Gordon  changed:

   What|Removed |Added

   Keywords||accepts-invalid
 CC||s...@iname.com


--- Comment #1 from Stewart Gordon  2010-10-07 04:33:04 PDT ---
Please remember to assign keywords to bug reports.  To everybody reading this:
Please look through issues you've reported and check for missing keywords.

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


[Issue 4988] Floats in structs are not equal on 0.0f vs -0.0f

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4988


bearophile_h...@eml.cc changed:

   What|Removed |Added

 CC||bearophile_h...@eml.cc


--- Comment #2 from bearophile_h...@eml.cc 2010-10-07 04:21:33 PDT ---
Performance is important, but correct semantics is more important.

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


[Issue 5009] New: TraceHandler not being called on Access Violation

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5009

   Summary: TraceHandler not being called on Access Violation
   Product: D
   Version: D2
  Platform: x86
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: c...@benjamin-thaut.de


--- Comment #0 from Benjamin Thaut  2010-10-07 02:54:34 
PDT ---
The TraceHandler that is built into the core runtime is not being called on
Access Violation errors. Try this piece of sourcecode:

import std.stdio;
import core.runtime;

Throwable.TraceInfo TraceHandler1(void* ptr){
writefln("TraceHandler1");
return null;
}

Throwable.TraceInfo TraceHandler2(void* ptr){
writefln("TraceHandler2");
return null;
}

void main(string[] argv){
Runtime.traceHandler(&TraceHandler1);
try {
int[] array = new int[20];
array[20] = 0;
}
catch(Error e){
}

Runtime.traceHandler(&TraceHandler2);

int* ptr = null;
*ptr = 0;
}

TraceHandler2 is never being called. I tested this with dmd 2.046, 2.048 and
2.049.

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


[Issue 5008] New: Bizarre "conflicts with __anonymous at" error with regex and indirectly imported phobos

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5008

   Summary: Bizarre "conflicts with __anonymous at" error with
regex and indirectly imported phobos
   Product: D
   Version: D1 & D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: rejects-valid
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: cbkbbej...@mailinator.com


--- Comment #0 from Nick Sabalausky  2010-10-07 
01:06:58 PDT ---
Not sure if this is a bug in DMD or Phobos:

-
module a;
import std.regex;
import b;

void main()
{
replace("hello", regex("X"), "Y");
}
-
module b;
public import std.string;
public import std.array;
-

> dmd a.d b.d

Result:
-
a.d(7): Error: std.regex.replace(Range,Engine,String) if (is(Unqual!(Engine) ==
Regex!(Unqual!(typeof(Range.init[0]) at
D:\DevTool\dmd\bin\..\src\phobos\std\regex.d(2807) conflicts with __anonymous
at 
-

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


[Issue 4988] Floats in structs are not equal on 0.0f vs -0.0f

2010-10-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4988


Don  changed:

   What|Removed |Added

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


--- Comment #1 from Don  2010-10-06 23:57:21 PDT ---
This also applies to NaNs:

assert( Foo( float.nan ) != Foo( float.nan ) ); // Works fine
auto a = Foo( float.nan );
auto b = Foo( float.nan );
assert( b != a ); // Asserts

The real problem is e2ir.c, line 2313, EqualExp::toElem(), which does a bitwise
compare for structs. That isn't valid if there are floating point numbers
inside.
This is a pain, because it needs to be considered recursively.

A quick-and-dirty fix would be to construct an opEquals whenever this happens:

clone.c StructDeclaration::needOpEquals() line 106.

if (tv->ty == Tstruct)
{   TypeStruct *ts = (TypeStruct *)tv;
StructDeclaration *sd = ts->sym;
if (sd->eq)
goto Lneed;
}
+if (tv->isfloating())
+goto Lneed;
}
Ldontneed:

But the problem with this is that it slows down all equality tests involving
floats. Maybe the inliner can take care of it, but generally I don't think it's
an acceptable solution.

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