const property don't wont return const reference to value

Zhenya zheny at list.ru
Sun Dec 23 05:20:11 PST 2012


Hi!
Explain me please what's wrong with this code:

module main;

struct foo
{
	int m_bar;
	@property const ref int bar() const
	{
		return m_bar;
	}
}

void main()
{
}

Error: cast(int)this.m_bar is not an lvalue


More information about the Digitalmars-d-learn mailing list