Cannot have properties on const references?

Steven Schveighoffer schveiguy at yahoo.com
Mon Sep 26 07:40:40 PDT 2011


On Sat, 24 Sep 2011 14:10:48 -0400, simendsjo <simendsjo at gmail.com> wrote:

> Sorry about the possible double post. I cannot see my previous..
>
> struct S {
>      @property int B() {
>          return 1;
>      }
> }
>
> void main() {
>      S s1;
>      auto a1 = s1.B; // ok
>      const(S) s2;
>      auto a2 = s2.B; // Error: function t.S.B () is not callable using  
> argument types ()
> }

If this is the error message it is a bug.

It should say:

function t.S.B () is not callable using argument types () const

I believe this is the message you'd get if it were a member function.

-Steve


More information about the Digitalmars-d-learn mailing list