[Issue 8389] New: Classes, nested in the same base class cannot be derived from.

2012-07-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8389

   Summary: Classes, nested in the same base class cannot be
derived from.
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: g...@boloneum.com


--- Comment #0 from Gor Gyolchanyan g...@boloneum.com 2012-07-13 23:26:04 PDT 
---
class Fruit
{
class Seed {} // Not static, because this.outer is necessary
}

class Apple: Fruit
{
class RedAppleSeed: Fruit.Seed {} 
class GreenAppleSeed: Fruit.Seed {}
}

DMD 2.059:

Error: class main.Apple.RedAppleSeed is nested within Apple, but super class
Seed is nested within Fruit
Error: class main.Apple.GreenAppleSeed is nested within Apple, but super class
Seed is nested within Fruit

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


[Issue 8388] std.traits.MemberFunctionsTuple doesn't work with constructors or destructors

2012-07-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8388



--- Comment #1 from Jonathan M Davis jmdavisp...@gmx.com 2012-07-13 23:33:57 
PDT ---
It looks like MermberFunctionsTuple only grabs virtual functions. This code

import std.stdio;
import std.traits;

class C
{
void foo()() {}
void goo() { foo(); }
}

void main()
{
foreach(f; MemberFunctionsTuple!(C, foo))
writeln(f.stringof);

foreach(f; MemberFunctionsTuple!(C, goo))
writeln(f.stringof);
}

just prints

goo()

foo() isn't printed. So, the constructors and destructor probably aren't being
grabbed, because they're non-virtual.

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


[Issue 4957] std.concurrency does not allow to pass Tid in struct fields

2012-07-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4957


Johan Hernandez thepumpkin1...@gmail.com changed:

   What|Removed |Added

 CC||thepumpkin1...@gmail.com


--- Comment #3 from Johan Hernandez thepumpkin1...@gmail.com 2012-07-14 
03:06:04 PDT ---
I ran into this issue too. We need a fix :(

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


[Issue 7973] BigInt %= long/ulong gives wrong value

2012-07-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7973



--- Comment #4 from github-bugzi...@puremagic.com 2012-07-14 03:55:37 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/5e7b33383a284e4b28fb27561012f6d1f618ec5c
Fix issue 7973 BigInt %= long/ulong gives wrong value

Previous fix only worked for const; this fixes immutable too.

https://github.com/D-Programming-Language/phobos/commit/52b5058d069de8f6a02a12c70a6fd495b79beff8
Merge pull request #685 from donc/bigint7993div

Fix issue 7973 BigInt %= long/ulong gives wrong value

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


[Issue 8389] Classes, nested in the same base class cannot be derived from.

2012-07-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8389


Guillaume Chatelet chatelet.guilla...@gmail.com changed:

   What|Removed |Added

 CC||chatelet.guilla...@gmail.co
   ||m


--- Comment #1 from Guillaume Chatelet chatelet.guilla...@gmail.com 
2012-07-14 05:09:35 PDT ---
Indeed. The following is valid Java code and I would have expected it to work
with D too as D took the Java way for OOP.

class Fruit {
class Seed {
}
}

class Apple extends Fruit {
class AppleSeed extends Fruit.Seed {
Apple getOuter() {
return Apple.this;
}
}
}

class Main {
public static void main(String[] args) {
final Apple apple = new Apple();
final Apple.AppleSeed appleSeed = apple.new AppleSeed();
assert (appleSeed instanceof Fruit.Seed);
assert (apple == appleSeed.getOuter());
assert (appleSeed.getOuter() instanceof Apple);
assert (appleSeed.getOuter() instanceof Fruit);
}
}

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


[Issue 8389] Classes, nested in the same base class cannot be derived from.

2012-07-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8389


Guillaume Chatelet chatelet.guilla...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||DUPLICATE


--- Comment #2 from Guillaume Chatelet chatelet.guilla...@gmail.com 
2012-07-14 05:15:02 PDT ---
*** This issue has been marked as a duplicate of issue 1175 ***

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


[Issue 1175] nested class inheritance

2012-07-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1175


Guillaume Chatelet chatelet.guilla...@gmail.com changed:

   What|Removed |Added

 CC||g...@boloneum.com


--- Comment #5 from Guillaume Chatelet chatelet.guilla...@gmail.com 
2012-07-14 05:15:02 PDT ---
*** Issue 8389 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 6999] parsing error for inout method/ wrong headergen

2012-07-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6999



--- Comment #2 from github-bugzi...@puremagic.com 2012-07-14 06:13:44 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/87704232d2328bca1994e57528a6b5a082072241
test case for Bug6999

https://github.com/D-Programming-Language/dmd/commit/847e4995e37ae7b8fa13a234b437822c09ed8945
apply scope storage class before function type semantic

 - fix issue 6999

 - this is needed if a storage class would
   affect type inference

https://github.com/D-Programming-Language/dmd/commit/98d9a4d97dacb18e5ac7d71643ccbc7f690b52ec
Merge pull request #531 from dawgfoto/Bug6999

fix Issue 6999 - parsing error for inout method/ wrong headergen

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


[Issue 6999] parsing error for inout method/ wrong headergen

2012-07-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6999


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

   What|Removed |Added

   Keywords||pull, rejects-valid
 Status|NEW |RESOLVED
 Resolution||FIXED


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


[Issue 4662] Array ops on const arrays

2012-07-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4662



--- Comment #4 from github-bugzi...@puremagic.com 2012-07-14 07:19:24 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/e917e1e404f8dc6b3440788d40fcf936c51bdf57
Fix Issue 4662 - Array ops on const arrays

For BinAssignExp, check that the lhs is assignable or mutable.

https://github.com/D-Programming-Language/dmd/commit/738114f00b12726a14fb4a65abe825957f82875d
Merge pull request #648 from yebblies/issue4662

Issue 4662 - Array ops on const arrays

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


[Issue 7385] Bad error message missing line number on invalid array op that isn't special cased

2012-07-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7385



--- Comment #3 from Kenji Hara k.hara...@gmail.com 2012-07-14 07:40:38 PDT ---
(In reply to comment #1)
 This bug also bypasses gagging:
 
 void main()
 {
 immutable double[] nums = [1.0, 2.0];
 static assert(!is(typeof({ nums[] /= nums[]; })));
 }
 
 Still prints the error.

(In reply to comment #2)
 The second test no longer prints an error on 2.059

The test case doesn't print error without -O switch, but with -O:

$ dmd -O -run test
Error: variable p1 used before set
Error: variable p0 used before set

It's another problem.

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


[Issue 7385] Bad error message missing line number on invalid array op that isn't special cased

2012-07-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7385


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

   What|Removed |Added

   Keywords||pull


--- Comment #4 from Kenji Hara k.hara...@gmail.com 2012-07-14 08:05:54 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1046

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


[Issue 4662] Array ops on const arrays

2012-07-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4662



--- Comment #5 from Kenji Hara k.hara...@gmail.com 2012-07-14 08:11:15 PDT ---
Additional fix for yebblies's patch:
https://github.com/D-Programming-Language/dmd/pull/1046

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


[Issue 5403] foreach requires front to be a function in a range

2012-07-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5403



--- Comment #3 from github-bugzi...@puremagic.com 2012-07-14 08:55:19 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/85511f3cca367fa0b1d49a4748f3f047ff138425
Fix Issue 5403 - foreach requires front to be a function in a range
Allow using any reasonable symbol as front/back/empty.
Remove references to the old range interface (head/toe/next/retreat)

https://github.com/D-Programming-Language/dmd/commit/b33914398d44535296d9a80e50a3c3eeba70a0a0
Merge pull request #203 from yebblies/issue5403

Issue 5403 - foreach requires front to be a function in a range

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


[Issue 7385] Bad error message missing line number on invalid array op that isn't special cased

2012-07-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7385



--- Comment #5 from github-bugzi...@puremagic.com 2012-07-14 11:42:13 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/ab7dd67616d93585da5748646cd1f1070480a88f
fix Issue 7385 - Bad error message missing line number on invalid array op that
isn't special cased

This also fixes the problem of commented out test for issue 4662.
Just calling error() function cannot stop the code generation while gagging
errors. If errors exist, we should return ErrorExp.

https://github.com/D-Programming-Language/dmd/commit/c56169b1fb0c4191361127666a136611ae6f7b6b
Merge pull request #1046 from 9rnsr/fix7385

Issue 7385 - Bad error message missing line number on invalid array op that
isn't special cased

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


[Issue 7385] Bad error message missing line number on invalid array op that isn't special cased

2012-07-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7385


Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

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


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


[Issue 7894] [CTFE] - goto within ForStatement restarts loop

2012-07-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7894



--- Comment #2 from github-bugzi...@puremagic.com 2012-07-14 13:03:37 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/9d6bc4560c3554b866f4bc8c6ace50b56c091953
Fix issue 7894 [CTFE] - goto within ForStatement restarts loop

Also fixes a very similar bug in do-while loops

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


[Issue 7894] [CTFE] - goto within ForStatement restarts loop

2012-07-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7894


Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

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


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


[Issue 8354] Some missing import std.math to use ^^ operator error messages

2012-07-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8354


Masahiro Nakagawa repeate...@gmail.com changed:

   What|Removed |Added

 CC||repeate...@gmail.com


--- Comment #1 from Masahiro Nakagawa repeate...@gmail.com 2012-07-14 
14:11:22 PDT ---
(In reply to comment #0)
 A wrong D2 program:
 
 void main() {
 int x1 = 10;
 auto y1 = x1 ^^ 5;
 }
 
 
 It gives a correct error message:
 test.d(3): Error: must import std.math to use ^^ operator
 
 
 
 But adding a second power it gives a wrong error message (dmd 2.060alpha):
 
 void main() {
 int x1 = 10;
 auto y1 = x1 ^^ 5;
 double x2 = 10.5;
 auto y2 = x2 ^^ 5;
 }
 
 
 test.d(3): Error: must import std.math to use ^^ operator
 test.d(5): Error: undefined identifier 'std'
 
 
 Here I'd like the second power to give an error message similar to the first
 one.

Following patch fixes this problem:

-

diff --git a/src/expression.c b/src/expression.c
index 392ca06..9916fbe 100644
--- a/src/expression.c
+++ b/src/expression.c
@@ -11472,6 +11472,7 @@ Expression *PowExp::semantic(Scope *sc)
 }

 static int importMathChecked = 0;
+static bool importMath = false;
 if (!importMathChecked)
 {
 importMathChecked = 1;
@@ -11480,13 +11481,20 @@ Expression *PowExp::semantic(Scope *sc)
 //printf(\t[%d] %s\n, i, mi-toChars());
 if (mi-ident == Id::math 
 mi-parent-ident == Id::std 
-!mi-parent-parent)
+!mi-parent-parent) {
+importMath = true;
 goto L1;
+}
 }
 error(must import std.math to use ^^ operator);
 return new ErrorExp();

  L1: ;
+} else {
+if (!importMath) {
+error(must import std.math to use ^^ operator);
+return new ErrorExp();
+}
 }

 e = new IdentifierExp(loc, Id::empty);

-


 
 
 Something similar happens if you import pow, this time for both powers:
 
 
 import std.math: pow;
 void main() {
 int x1 = 10;
 auto y1 = x1 ^^ 5;
 double x2 = 10.5;
 auto y2 = x2 ^^ 5;
 }
 
 
 test.d(4): Error: undefined identifier 'std'
 test.d(6): Error: undefined identifier 'std'

I can't judge the this problem is bug or spec.
'import std.math: pow' does not import 'std' namespace,
but dmd replaces ^^ with std.math.sqrt or std.math.pow.

This is the same problem below:

-
import std.math : sqrt;

void main()
{
real x1 = 10;
auto y1 = std.math.sqrt(x1);
}

m.d(6): Error: undefined identifier std
-

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


[Issue 5403] foreach requires front to be a function in a range

2012-07-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5403


Kenji Hara k.hara...@gmail.com 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 6497] [safeD] Can take address of local variable through ?:

2012-07-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6497



--- Comment #2 from github-bugzi...@puremagic.com 2012-07-14 20:12:56 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/40755eef0bbc746375aec08e7b66d4196a100c38
Issue 6497 - [safeD] Can take address of local variable through ?:

If the compiler rewrote `(a ? b : c)` to `*(a ? b : c)`, re-run semantic on
the `AddrExp`s to ensure they don't take addresses of local variables.

Fixes issue 6497

https://github.com/D-Programming-Language/dmd/commit/fe4ea16128943196247b28e0ccc804c69e52d255
Merge pull request #664 from yebblies/issue6497

Issue 6497 - [safeD] Can take address of local variable through ?:

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


[Issue 6497] [safeD] Can take address of local variable through ?:

2012-07-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6497


Kenji Hara k.hara...@gmail.com 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: ---