private with alias this

Zhenya zheny at list.ru
Mon Dec 24 12:36:45 PST 2012


Hi!
Is it correct,that this code doesn't compile:

module foo;

struct Foo
{
     private int bar;
     alias bar this;
}

///////////////////////////////

module main;

import foo;

void main()
{
     Foo b;
     int a = b;//Error:undefined identifier 'bar', did you mean 
'template back(T) //if (!isNarrowString!(T[]))'?
     b = a;//cannot implicitly convert expression (a) of type int 
to Foo
}
?


More information about the Digitalmars-d-learn mailing list