[Issue 5091] New: main runs after unittests

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

   Summary: main runs after unittests
   Product: D
   Version: D1 & D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: simen.kja...@gmail.com


--- Comment #0 from Simen Kjaeraas  2010-10-20 17:22:25 
PDT ---
When compiling a program with dmd -unittest, after the unittests are run,
main() is called. This is rarely wanted behavior, so should not be the default.

Currently, it is possible to customize main to sidestep the problem:

void main( ) {
version( unittest ) {
} else {
// Your program
}
}

However, this is cluttering and mixes your application code with versioning
code.

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


[Issue 5090] Assertion `sz <= vsz' failed with struct literal initializing zero length array

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


bearophile_h...@eml.cc changed:

   What|Removed |Added

 CC||bearophile_h...@eml.cc


--- Comment #1 from bearophile_h...@eml.cc 2010-10-20 16:35:32 PDT ---
This needs to be an error, because that 0 value has nowhere to be stored into:

struct A { int[0] b; }
A b = {b : 0};

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


[Issue 5090] New: Assertion `sz <= vsz' failed with struct literal initializing zero length array

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

   Summary: Assertion `sz <= vsz' failed with struct literal
initializing zero length array
   Product: D
   Version: D1 & D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: ibuc...@ubuntu.com


--- Comment #0 from Iain Buclaw  2010-10-20 16:14:46 PDT ---
Test cases:

struct A { int[0] b; }
A a = A(0); // Fails, compiler aborts
A b = {b:0}; // OK, but perhaps shouldn't be.
A c = A([]); // OK
A d = {b:[]}; // OK



Although the compiler shouldn't issue an assert, a zero length array
should be enforced to have a 0 length initializer.

Regards

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


[Issue 5089] New: feqrel does not compile for floats

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

   Summary: feqrel does not compile for floats
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: ah0801...@yahoo.com


--- Comment #0 from Austin Hastings  2010-10-20 16:07:10 
PDT ---
With 2.049, this code:
==
module scratch;

import std.math;

void foo() {
float a = 1, b = 1.001;

auto same = feqrel( a, b ) > 15;
}
==

Emits this diagnostic:
==
$ dmd scratch.d
d:\Devel\D\dmd2\windows\bin\..\..\src\phobos\std\math.d(3286): Error: function
std.math.feqrel!(float).feqrel has no return statement, but is expected to
return a value of type int
d:\Devel\D\dmd2\windows\bin\..\..\src\phobos\std\math.d(8): Error: template
instance std.math.feqrel!(float) error instantiating
==

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


[Issue 3092] Indexing a tuple produces a tuple containing the indexed element

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


Leandro Lucarella  changed:

   What|Removed |Added

 CC||llu...@gmail.com


--- Comment #13 from Leandro Lucarella  2010-10-20 15:55:13 
PDT ---
(In reply to comment #8)
> I have now fixed the bug, it's a trivial 7 line patch which teaches
> TypeSArray::resolve(...) to recognize if it's indexing a type element. Without
> the patch, TypeSArray::resolve(...) will create a 1-element-slice when 
> indexing
> a type in a tuple. This fixes the bug described in this issue.
> 
> This patch does not fix the pragma(msg, "values:", values); bugs, which is
> caused by another bug I described in a previous comment. That one would also 
> be
> easy to fix, it's only a formatting bug, I'm just not sure how a proper patch
> for that would look like.
> 
> I also tested dmd rev 714 (that one in branch dmd1.x) and my patched version 
> of
> it in dstress. No improvements, regressions or changes were introduced. I then
> created a testcase that can be added to the dstress/compile/t directory, which
> passes with my patch applied, but fails in dmd rev 714.

Added to dstress, changeset 1622:
http://www.dsource.org/projects/dstress/changeset/1622%3Ad402aa53926c

Thanks!

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


[Issue 5088] New: Cannot cast const(int) to long in @safe function

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

   Summary: Cannot cast const(int) to long in @safe function
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: rejects-valid
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don  2010-10-20 15:24:31 PDT ---
Even though they are value types. It seems to want to you to do
cast(const(long))
---
@safe:
void foo5088(const(int)[] x)
{
   long a = cast(long)x[0];
}

void main()
{
   int[2] a;
   a[] = 6;
   foo5088(a);
}


bug.d(36): Error: cast from const(int) to ulong not allowed in safe code

-- 
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-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4926


Don  changed:

   What|Removed |Added

 CC||sandf...@jhu.edu


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

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


Don  changed:

   What|Removed |Added

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


--- Comment #1 from Don  2010-10-20 11:55:39 PDT ---
This has already been fixed in svn.

*** 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 3072] tuples can't be aliases ( except when the aliases are templates. )

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


Rob Jacques  changed:

   What|Removed |Added

   Keywords||accepts-invalid,
   ||rejects-valid, spec
 CC||sandf...@jhu.edu
Version|1.00|D1 & D2
Summary|tuples can't be aliases |tuples can't be aliases (
   ||except when the aliases are
   ||templates. )


--- Comment #1 from Rob Jacques  2010-10-20 10:59:44 PDT ---
In general template tuples can't contain alias template parameters but it
appears that there is an exception to this rule when the parameter is itself a
template. 

DMD 2.049

T foo(T)(T t) { return t; }
template map1(fun...) {
enum map1 = 42;
}
template map2(T, U...) {
static if(U.length > 0) enum map2 = map2!(U);
elseenum map2 = 42;
}

void main() {
auto x = map1!(char,foo);  // compiles
auto y = map2!(char,foo);  // doesn't compile
auto z = map1!(char,map1); // compiles
auto w = map2!(char,map1); // doesn't compile
return;
}

I've added the accepts-invalid, rejects-valid and spec keywords, since tuples
of aliases should either work or not-work and the behavior should be documented
in the spec. I'd lean towards not-work, since tuples of aliases seem to be
buggy (i.e. Issue 5087) not to mention that alias parameters are buggy(i.e.
issue 5082)

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


[Issue 5087] New: Assertion failure: 'precedence[e->op] != PREC_zero' on line 816 in file 'expression.c'

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

   Summary: Assertion failure: 'precedence[e->op] != PREC_zero' on
line 816 in file 'expression.c'
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: sandf...@jhu.edu


--- Comment #0 from Rob Jacques  2010-10-20 10:31:40 PDT ---
Using DMD 2.049, using the msg pragma on a template tuple instantiated from a
template function results in an ICE.:

Assertion failure: 'precedence[e->op] != PREC_zero' on line 816 in file
'expression.c'

Test code:

T foo(T)(T t) { return t; }
template map(fun...) {
pragma(msg,fun);
enum map = 5;
}

void main() {
map!foo;
return;
}

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


[Issue 5076] std.algorithm.sorted / schwartzSorted

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



--- Comment #9 from Peter Alexander  2010-10-20 
08:49:43 PDT ---
(In reply to comment #8)
> See another case:
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=22381
> This is supposed to not work:
> sort(map(...))
> This is supposed to work:
> sorted(map(...))

Just implement sorted et al. something like this:

auto sorted(Output = ElementType!InputRange[], InputRange)(InputRange range)
{
  Output output = Output(range); // copy range into new container
  sort(output);
  return output;
}

I don't know if you can construct built-in arrays like that, but you should,
and you can always specialise for it if necessary.

This allows the input range to be whatever it likes (including Map), and also
gives you the choice of the output range.

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


[Issue 3092] Indexing a tuple produces a tuple containing the indexed element

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



--- Comment #12 from Don  2010-10-20 07:20:29 PDT ---
(In reply to comment #11)
> (In reply to comment #9)
> > 
> > Sounds as though you have been running dstress. Could you please post the
> > results somewhere? I would be very interested to see how many dstress bugs 
> > are
> > still unfixed in the most recent DMD version.
> 
> Sure, see here: http://drop.io/dstres_results_rev714
> It contains the dstress results for dmd rev714 and my patched version. I can
> also test the most recent dmd version later, but my homework comes first :)

Thanks! That's exactly what I was after.
There has been 1 regression since I last saw dstress results (for DMD1.051).
I've created bug 5086.
Don't bother redoing it with the latest DMD, there won't be any changes.

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


[Issue 5086] Regression(1.062): Stack overflow with recursive alias declaration

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



--- Comment #1 from Don  2010-10-20 07:17:56 PDT ---
And this is nocompile/c/const_34_A.d, which is also failing. In total, 5
dstress cases are now hitting a stack overflow because of this bug. D2 is not
affected.

const auto a = a;

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


[Issue 5086] New: Regression(1.062): Stack overflow with recursive alias declaration

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

   Summary: Regression(1.062): Stack overflow with recursive alias
declaration
   Product: D
   Version: D1
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: ice-on-invalid-code
  Severity: regression
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don  2010-10-20 07:12:25 PDT ---
This is dstress nocompile/a/alias_30_J.d and nocompile/a/alias_30_K.d
---
alias a b;
alias b a;

b x;
---
bug.d(7): Error: alias test0.a recursive alias declaration
Stack overflow
---
D1 only, worked in 1.061.
Doesn't happen if DMD is compiled in debug mode.

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


[Issue 5085] New: std.variant.Algebraic name

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

   Summary: std.variant.Algebraic name
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: minor
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2010-10-20 05:04:21 PDT ---
Algebraic data types may be both product types and sum types:

>From Wikipedia:
http://en.wikipedia.org/wiki/Algebraic_data_types

> Special cases of algebraic types are product types i.e. tuples and
> records (only one constructor), sum types or tagged unions (many
> constructors with a single argument) and enumerated types (many
> constructors with no arguments). Algebraic types are one kind of
> composite type (i.e. a type formed by combining other types).


So std.typecons.Tuple too is an algebraic data type, it's a product type. The
data structure implemented by std.variant.Algebraic is just a special case of
algebraic data type, it's a sum type.

So it is better if the name of std.variant.Algebraic refers to 'sum type' or a
'tagged union' instead to generic data types.

So maybe "taggedUnion" is a more descriptive name of its purposes for
programmers of C-like languages.

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


[Issue 5076] std.algorithm.sorted / schwartzSorted

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



--- Comment #8 from bearophile_h...@eml.cc 2010-10-20 04:04:21 PDT ---
See another case:

http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=22381

This is supposed to not work:
sort(map(...))

This is supposed to work:
sorted(map(...))

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


[Issue 5084] New: Static code does not ignore instance names during name lookup

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

   Summary: Static code does not ignore instance names during name
lookup
   Product: D
   Version: D2
  Platform: x86
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: ah0801...@yahoo.com


--- Comment #0 from Austin Hastings  2010-10-20 03:53:30 
PDT ---
In the code
==
module scratch;

import std.stdio;

int[ 3 ] x;

struct S {

int[ 2 ] x;

static void foo() {
writeln( x[2] );
}
}
=

I would expect that the static method performed static name lookup. In this
case, 
that would resolve the x[] reference to the variable at module scope.

Instead, the reference is apparently resolved to the member, despite the member
being an illegal reference. If the [2], which generates an "index out of
bounds" error, is replaced with [1], then the compiler proceeds to issue a
"this required for reference to member" error.

Obviously, .x would work in this case, but I think this may be a general bug.
Alternatively, could someone provide a pointer to the rules for name lookup?

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


[Issue 3092] Indexing a tuple produces a tuple containing the indexed element

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



--- Comment #11 from Manuel K�nig  2010-10-20 03:48:35 PDT 
---
(In reply to comment #9)
> 
> Sounds as though you have been running dstress. Could you please post the
> results somewhere? I would be very interested to see how many dstress bugs are
> still unfixed in the most recent DMD version.

Sure, see here: http://drop.io/dstres_results_rev714
It contains the dstress results for dmd rev714 and my patched version. I can
also test the most recent dmd version later, but my homework comes first :)

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


[Issue 5083] New: module object cannot read file 'object.d'

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

   Summary: module object cannot read file 'object.d'
   Product: D
   Version: D2
  Platform: x86
OS/Version: Linux
Status: NEW
  Severity: blocker
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: andy.el...@paradise.net.nz


--- Comment #0 from Andy Elvey  2010-10-20 03:29:56 
PDT ---
This problem has been reported before, but I am reporting it again - it
*really* needs to be fixed. I'm using Ubuntu 10.04.   

I originally mentioned this problem on the D mailing-list here - 
http://www.mail-archive.com/digitalmars-d-le...@puremagic.com/msg07626.html

I've tried installing D three ways - 
* Using the .deb file from Digital Mars. This seemed to install fine, but I got
the "cannot read file object.d" when I tried to compile a simple program. 

* Running "linux.mak" in the /src directory. Same error. 

* Using the ddebber tool. Seemed to install fine, but the same error again. 

The problem seems to be with the dmd.conf file, but the end-result is that the
install does not work "out-of-the-box". Knowing where the problem seems to be
is one thing - fixing it is quite another.  

An aside - it would be a *great deal of help* if the install process created a
log that you could refer to afterwards. 

I'm not a complete newbie. I've compiled and installed many applications in my
years on Linux, but few have given me as many problems as D. Even GHC (Haskell) 
which is a BIG application, installs and runs flawlessly. 

This problem is disappointing. I still believe that D is a great language, but
problems like this *really* need to be fixed for it to gain more users. 
- Andy

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


[Issue 5026] ICE(expression.c) Incomplete mixin expression + char[] to char assignment

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


Don  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


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


[Issue 5071] passing value by ref to a function with an inner dynamic closure results in a wrong code

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


Walter Bright  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #3 from Walter Bright  2010-10-20 
01:16:13 PDT ---
http://www.dsource.org/projects/dmd/changeset/724

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


[Issue 2944] std.math.approxEqual doesn't work with infinity.

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


yebblies  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 CC||yebbl...@gmail.com
 Resolution|FIXED   |


--- Comment #2 from yebblies  2010-10-20 00:46:06 PDT ---
The current changes still miss the -infinity case.  Reopening so it doesn't get
forgotten.

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


[Issue 2451] Adding structs that use opAssign or postblit to an AA is broken

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


Walter Bright  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution||FIXED


--- Comment #11 from Walter Bright  2010-10-20 
00:16:30 PDT ---
http://www.dsource.org/projects/dmd/changeset/723

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


[Issue 1841] Closure detection doesn't work when variable is used in a nested function

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



--- Comment #3 from Don  2010-10-19 23:56:53 PDT ---
See also bug 1908, test case 5w, for another example.

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


[Issue 1908] Various closure problems

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


Don  changed:

   What|Removed |Added

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


--- Comment #7 from Don  2010-10-19 23:55:58 PDT ---
Test case 8w is a duplicate of bug 3326, and isn't actually a closure bug. 
Test case 5w is a duplicate of bug 1841. I'm therefore closing this bug, as the
other cases have been fixed.

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