www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - DMD 0.126, wow!

reply "Andrew Fedoniouk" <news terrainformatica.com> writes:
import std.stdio;

class A
{
 class B:A
 {
   const int C = 5;
 }
}

int main()
{
 writef ("1 %d\n", A.B.C);
 writef ("2 %d\n", A.B.B.C);
 writef ("3 %d\n", A.B.B.B.C);
 writef ("4 %d\n", A.B.B.B.B.C);
 writef ("5 %d\n", A.B.B.B.B.B.C);
 writef ("6 %d\n", A.B.B.B.B.B.B.C);
 writef ("7 %d\n", A.B.B.B.B.B.B.B.C);
 writef ("8 %d\n", A.B.B.B.B.B.B.B.B.C);
 //.....
 writef ("X %d\n", 
A.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.C);
 return 0;
}

Compiles and works just fine :) 
Jun 08 2005
next sibling parent reply John Reimer <brk_6502 yahoo.com> writes:
Andrew Fedoniouk wrote:
 import std.stdio;
 
 class A
 {
  class B:A
  {
    const int C = 5;
  }
 }
 
 int main()
 {
  writef ("1 %d\n", A.B.C);
  writef ("2 %d\n", A.B.B.C);
  writef ("3 %d\n", A.B.B.B.C);
  writef ("4 %d\n", A.B.B.B.B.C);
  writef ("5 %d\n", A.B.B.B.B.B.C);
  writef ("6 %d\n", A.B.B.B.B.B.B.C);
  writef ("7 %d\n", A.B.B.B.B.B.B.B.C);
  writef ("8 %d\n", A.B.B.B.B.B.B.B.B.C);
  //.....
  writef ("X %d\n", 
 A.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.C);
  return 0;
 }
 
 Compiles and works just fine :) 
 
 
LOL! You just had to try that, didn't you? Good ammo for obfuscated D. Nice to know inner classes have more than one use. ;) -JJR
Jun 08 2005
parent "Andrew Fedoniouk" <news terrainformatica.com> writes:
"John Reimer" <brk_6502 yahoo.com> wrote in message 
news:d88m0j$ii0$1 digitaldaemon.com...
 Andrew Fedoniouk wrote:
 import std.stdio;

 class A
 {
  class B:A
  {
    const int C = 5;
  }
 }

 int main()
 {
  writef ("1 %d\n", A.B.C);
  writef ("2 %d\n", A.B.B.C);
  writef ("3 %d\n", A.B.B.B.C);
  writef ("4 %d\n", A.B.B.B.B.C);
  writef ("5 %d\n", A.B.B.B.B.B.C);
  writef ("6 %d\n", A.B.B.B.B.B.B.C);
  writef ("7 %d\n", A.B.B.B.B.B.B.B.C);
  writef ("8 %d\n", A.B.B.B.B.B.B.B.B.C);
  //.....
  writef ("X %d\n", 
 A.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.C);
  return 0;
 }

 Compiles and works just fine :)
LOL! You just had to try that, didn't you?
:) I did small compiler for subset of Java once. So I can predict typical problems more or less reliably. That was just first what came up in my mind.
 Good ammo for obfuscated D. Nice to know inner classes have more than one 
 use. ;)
That inners... "Stay tuned" as they say and keep around your favorite helmet. Andrew.
Jun 09 2005
prev sibling next sibling parent "Unknown W. Brackets" <unknown simplemachines.org> writes:
I can imagine there are some practical uses for this behavior...

-[Unknown]


 import std.stdio;
 
 class A
 {
  class B:A
  {
    const int C = 5;
  }
 }
 
 int main()
 {
  writef ("1 %d\n", A.B.C);
  writef ("2 %d\n", A.B.B.C);
  writef ("3 %d\n", A.B.B.B.C);
  writef ("4 %d\n", A.B.B.B.B.C);
  writef ("5 %d\n", A.B.B.B.B.B.C);
  writef ("6 %d\n", A.B.B.B.B.B.B.C);
  writef ("7 %d\n", A.B.B.B.B.B.B.B.C);
  writef ("8 %d\n", A.B.B.B.B.B.B.B.B.C);
  //.....
  writef ("X %d\n", 
 A.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.C);
  return 0;
 }
 
 Compiles and works just fine :) 
 
 
Jun 09 2005
prev sibling next sibling parent Stewart Gordon <smjg_1998 yahoo.com> writes:
Andrew Fedoniouk wrote:
 import std.stdio;
 
 class A
 {
  class B:A
  {
    const int C = 5;
  }
 }
 
 int main()
 {
  writef ("1 %d\n", A.B.C);
  writef ("2 %d\n", A.B.B.C);
  writef ("3 %d\n", A.B.B.B.C);
  writef ("4 %d\n", A.B.B.B.B.C);
  writef ("5 %d\n", A.B.B.B.B.B.C);
  writef ("6 %d\n", A.B.B.B.B.B.B.C);
  writef ("7 %d\n", A.B.B.B.B.B.B.B.C);
  writef ("8 %d\n", A.B.B.B.B.B.B.B.B.C);
  //.....
  writef ("X %d\n", 
 A.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.C);
  return 0;
 }
 
 Compiles and works just fine :) 
Yes, since B is both a member of A and a subclass of A, it inherits itself. A.B.B is the same thing as A.B, and so the compiler would reduce each long expression to the previous and so on. Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Jun 09 2005
prev sibling parent =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= writes:
Andrew Fedoniouk wrote:
 import std.stdio;

 class A
 {
  class B:A
  {
    const int C = 5;
  }
 }

 int main()
 {
  writef ("1 %d\n", A.B.C);
  writef ("2 %d\n", A.B.B.C);
  writef ("3 %d\n", A.B.B.B.C);
  writef ("4 %d\n", A.B.B.B.B.C);
  writef ("5 %d\n", A.B.B.B.B.B.C);
  writef ("6 %d\n", A.B.B.B.B.B.B.C);
  writef ("7 %d\n", A.B.B.B.B.B.B.B.C);
  writef ("8 %d\n", A.B.B.B.B.B.B.B.B.C);
  //.....
  writef ("X %d\n",
 A.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.C);
  return 0;
 }

 Compiles and works just fine :)
Added to DStress as http://dstress.kuehne.cn/run/c/class_16.d Thomas
Jun 11 2005