www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - collection of old bugs

Since last time you were talking about releasing DMD 1.0, and since 
these haven't been fixed yet, I thought I should post them again (all 
tested with DMD 0.110):

////////////////////////////////////////////
version(linux):
void foo () {}
////////////////////////////////////////////

On Windows, that code generates _D4test3fooFZv. Equivalent code on 
linux, also generates the function.


////////////////////////////////////////////
class B
{
     void foo(int a) {}
     int opCast () { return 0; }
}

class A:B {
}

void main ()
{
     (new A).foo = 2;
}
////////////////////////////////////////////

dmd segfaults on linux, crashes on Windows.


////////////////////////////////////////////
void bar ( void delegate () dg ) { dg(); }

template MCaller ( alias f )
{
     void caller ( int i )      // line 5
     {
         bar ( delegate { f(i); } );
     }
}

class A
{
     mixin MCaller!(foo);

     void foo (int i) {}
}

class B
{
     mixin MCaller!(baz);

     void baz (int i) {}
}

void main ()
{
}
////////////////////////////////////////////

test.d(5): function test.A.MCaller!(foo).caller cannot access frame of 
function __funclit1


////////////////////////////////////////////
void foo ( ... )
{
     foreach ( TypeInfo ti ; _arguments )
         ti.print();
}

void main ()
{
     my_int m;
     aliased_int i;
     E e;
     char [] [ char [] ] aa;
     Object [] oa;
     foo(m,i,e,aa,oa);
}

typedef int my_int;

alias int aliased_int;

enum E { x }
////////////////////////////////////////////

outputs:
TypeInfo_Typedef
int
TypeInfo
TypeInfo
TypeInfo

expected:
my_int
aliased_int
E
char[][char[]]      (or something descriptive)
Object[]            (ditto)


////////////////////////////////////////////
import std.recls;
import std.utf;

void main ()
{
     Search s = new Search ( ".", "*.*", RECLS_FLAG.RECLS_F_FILES );
     foreach ( Entry e; s )
                 validate(e.File);
         //writefln(e.File);
         //writefln( fix(e.File)  );
}

char [] fix ( char [] x )
{
     wchar []  r;
     r.length = x.length;
     for ( uint i;i<x.length;++i)
         r[i] = x[i];
     return toUTF8 ( r );
}
////////////////////////////////////////////

When run, if there's a file with non-ASCII characters in its name, it 
complains with an invalid UTF-8 sequence.


////////////////////////////////////////////
struct A
{
     int [10] arr;
}          // line 3

void main ()
{
     A a;
     a.arr.length = 20;
}
////////////////////////////////////////////

While not a bug, I think the message could be better:

test.d(3): constant *(#a + 0).length is not an lvalue


_______________________
Carlos Santander Bernal
Dec 31 2004