www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Classes in scopes

reply bearophile <bearophileHUGS lycos.com> writes:
I think I may have found another bug (n. 41) in DMD:

void main() {
    { class Foo {} } 
    { class Foo {} }
}

It produces:
t.o:(.rodata+0x34): multiple definition of `_Dmain3Foo6__initZ'
t.o:(.rodata+0x0): first defined here
...

-------------------
Unrelated:
I may have found a bug in std.intrinsics too, shown by this code:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=78637

Bye,
bearophile
Oct 24 2008
parent Sergey Gromov <snake.scaly gmail.com> writes:
Fri, 24 Oct 2008 04:02:31 -0400,
bearophile wrote:
 I think I may have found another bug (n. 41) in DMD:
 
 void main() {
     { class Foo {} } 
     { class Foo {} }
 }
 
 It produces:
 t.o:(.rodata+0x34): multiple definition of `_Dmain3Foo6__initZ'
 t.o:(.rodata+0x0): first defined here
 ...
From the specs: "A nested class is a class that is declared inside the scope of a function or another class." It doesn't say a class can be local to a block of code.
 -------------------
 Unrelated:
 I may have found a bug in std.intrinsics too, shown by this code:
 http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=78637
Why don't you file them in bugzilla?
Oct 24 2008