www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - compiler bug?

reply Ant^2i <Ant^2i_member pathlink.com> writes:
Ok, below code doesn't work.

class Foo(T)
{
Node sentinel; // using Node before it's definition crashes compiler?

struct Node
{
T value; // it seems that template's T have something to do with it
}
}

void main()
{
Foo!(int) bar=new Foo!(int); // compiler can't create new class
}
Jul 04 2005
next sibling parent Stewart Gordon <smjg_1998 yahoo.com> writes:
Ant^2i wrote:
 Ok, below code doesn't work.
 
 class Foo(T)
 {
 Node sentinel; // using Node before it's definition crashes compiler?

That any code crashes the compiler is a bug.
 struct Node
 {
 T value; // it seems that template's T have something to do with it
 }
 }
 
 void main()
 {
 Foo!(int) bar=new Foo!(int); // compiler can't create new class
 }

Is this the exact wording of an error message? Or your speculation of what's triggering the crash? Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Jul 06 2005
prev sibling parent reply Greg Smith <greg siliconoptix.com> writes:
Ant^2i wrote:

 Ok, below code doesn't work.
 
 class Foo(T)
 {
 Node sentinel; // using Node before it's definition crashes compiler?
 
 struct Node
 {
 T value; // it seems that template's T have something to do with it
 }
 }

I get 'a.d(6): struct Node no size yet for forward reference'. Running "gdc (GCC) 3.3.3 (cygwin special)" When you say 'crashes the compiler', do you mean 'the compiler prints an error message about the source code, and exits?' If so, that's not a 'crash'. Don't confuse people by saying it is. Say what happened. And what version you're running. On what. If not, pardon me; but it happens a lot. And you should still say what happened.
Jul 08 2005
parent Stewart Gordon <smjg_1998 yahoo.com> writes:
Greg Smith wrote:
<snip>
 I get 'a.d(6): struct Node no size yet for forward reference'.
 Running "gdc (GCC) 3.3.3 (cygwin special)"
 
 When you say 'crashes the compiler', do you mean 'the compiler prints
 an error message about the source code, and exits?'

Just because it doesn't crash GDC doesn't mean it doesn't crash DMD.
 If so, that's not a 'crash'. Don't confuse people by saying it is.
 Say what happened. And what version you're running. On what.
 
 If not, pardon me; but it happens a lot. And you should still say what 
 happened.

True. But I wouldn't call it fair to speculate that the OP's misusing the word "crash" in this instance. Stewart. -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d- s:- a->--- UB P+ L E W++ N+++ o K- w++ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++>++++ h-- r-- !y ------END GEEK CODE BLOCK------ My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Jul 11 2005