www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - two compiler crashes

reply "Ivan Senji" <ivan.senji public.srce.hr> writes:
These two code fragments crash the compiler:

<CODE1 compiler crash>
import std.stdio;

class Conversion(T,U)
{
 private
 {
  typedef char Small;
  class Big{char[2] dummy;}
  static Small Test(U u);
  static Big Test(...);
  static T MakeT();
 }
 public:
  enum {exists = (Test(MakeT())).sizeof == (Small).sizeof}
}

int main ( char [] [] args )
{
 writefln(Conversion!(double,int).exists);
 return 1;
}
</CODE1>

<CODE2 compiler crash>
import std.stdio;
import std.c.stdlib;

class Cout
{
 Cout set(int x)
 {
  printf("%d",x);
  return this;
 }
 alias set opShl;
}

int main ( char [] [] args )
{
 Cout cout = new Cout;
 cout << 5 << 4;
 writefln,getch;
 return 1;
}
</CODE2>
Oct 15 2004
parent Thomas Kuehne <eisvogel users.sourceforge.net> writes:
added to dstress:
svn://svn.kuehne.cn/dstress/nocompile/bug_20041016_A.d (code 1)
svn://svn.kuehne.cn/dstress/nocompile/bug_20041016_B.d (code 2)

Thomas

In article <ckpj76$2r3m$1 digitaldaemon.com>, Ivan Senji says...
These two code fragments crash the compiler:

<CODE1 compiler crash>
import std.stdio;

class Conversion(T,U)
{
 private
 {
  typedef char Small;
  class Big{char[2] dummy;}
  static Small Test(U u);
  static Big Test(...);
  static T MakeT();
 }
 public:
  enum {exists = (Test(MakeT())).sizeof == (Small).sizeof}
}

int main ( char [] [] args )
{
 writefln(Conversion!(double,int).exists);
 return 1;
}
</CODE1>

<CODE2 compiler crash>
import std.stdio;
import std.c.stdlib;

class Cout
{
 Cout set(int x)
 {
  printf("%d",x);
  return this;
 }
 alias set opShl;
}

int main ( char [] [] args )
{
 Cout cout = new Cout;
 cout << 5 << 4;
 writefln,getch;
 return 1;
}
</CODE2>
Oct 28 2004