T[] -> T* implicit converstion still working?

Bruno Medeiros brunodomedeiros+spam at com.gmail
Mon Dec 11 07:06:13 PST 2006


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


More information about the Digitalmars-d-bugs mailing list