www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - T[] -> T* implicit converstion still working?

reply Brad Roberts <braddr puremagic.com> writes:
With dmd 0.177, shouldn't this be failing?  I'd like confirmation before 
I file the bug report:

import std.stdio;

class A {
     void print() { writefln("a"); }
}

int main() {
     A[1] a = new A[1]; a[0].print();
     A[]  b = new A[1]; b[0].print();
     A*   c = a;        c.print();
     A*   d = b;        d.print();
     return 0;
}

I expected both the c and d assignments to fail with a type mismatch?

Later,
Brad
Dec 10 2006
parent Bruno Medeiros <brunodomedeiros+spam com.gmail> writes:
Brad Roberts wrote:
 With dmd 0.177, shouldn't this be failing?  I'd like confirmation before 
 I file the bug report:
 
 import std.stdio;
 
 class A {
     void print() { writefln("a"); }
 }
 
 int main() {
     A[1] a = new A[1]; a[0].print();
     A[]  b = new A[1]; b[0].print();
     A*   c = a;        c.print();
     A*   d = b;        d.print();
     return 0;
 }
 
 I expected both the c and d assignments to fail with a type mismatch?
 
 Later,
 Brad
I get: main.d(10): Error: cannot implicitly convert expression (a) of type A[1] to A* main.d(11): Error: cannot implicitly convert expression (b) of type A[] to A* with DMD .177 on WinXP. -- Bruno Medeiros - MSc in CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
Dec 11 2006