Cannot have properties on const references?

Andrej Mitrovic andrej.mitrovich at gmail.com
Sat Sep 24 11:19:43 PDT 2011


On 9/24/11, simendsjo <simendsjo at gmail.com> wrote:
> struct S {
>      @property int B() {
>          return 1;
>      }
> }

I've reported the error message just recently because it's very
uninformative. But the solution is to add const to your property
function:

struct S {
     @property int B() const {
         return 1;
     }
}


More information about the Digitalmars-d-learn mailing list