Extremely funny behavior .. could be a bug?

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Sep 12 08:26:33 PDT 2014


There are multiple problems with the code. Is that really what you are 
using?

On 09/12/2014 06:35 AM, seany wrote:
> consider the following :
>
> in file a.d
>
> module a;
>
> class class_a
> {
>
>     struct RESULT{
>     string[] raw;
>     void* res;
>    }
>
>
> RESULT r;
>
> void dothing()
> {
>     r = new RESULT;

Error: cannot implicitly convert expression (new RESULT) of type RESULT* 
to RESULT

>
>     string aa = "string";
>
>     r.raw ~= aa;
>     r.res = cast(void*) aa;
> }
>
> }
>
>
> in file b.d
>
> import a;    // import path is okey
>
> class class_b;

That semicolon should not be there?

> {
>
>     void doThings(class_a * ptr_a)
>    {
>       class_a A = &ptr_a;

Error: cannot implicitly convert expression (& ptr_a) of type class_a** 
to a.class_a

[...]

Ali



More information about the Digitalmars-d-learn mailing list