const method and return type

Andrea Fontana nospam at example.com
Fri Dec 13 15:46:13 PST 2013


class A
{
     auto getter() const
     {
         return property;
     }

     int property = 0;
}


Please notice that getter method is marked as const. Why this 
method return "const int"?

If i force it declaring:

int getter() const

it returns "int". It takes me a lot to understand where the issue 
was in my code.

Is it a bug?



More information about the Digitalmars-d-learn mailing list