[Issue 13731] New: Wrong interpretation of const keyword when creating @property returning class
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Thu Nov 13 14:41:37 PST 2014
    
    
  
https://issues.dlang.org/show_bug.cgi?id=13731
          Issue ID: 13731
           Summary: Wrong interpretation of const keyword when creating
                    @property returning class
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: buday48 at mail.ru
class Foo
{
}
class Bar
{
    Foo foo_;
    Foo foo() const @property
    {
        return this.foo_;      //<- Compilation Error
    }
}
void main() {
}
DMD 2.066 gives an error message:
app.d(10): Error: cannot implicitly convert expression (this.foo_) of type
const(Foo) to app.Foo
const keyword is actually used to specify function foo() but not its type Foo
--
    
    
More information about the Digitalmars-d-bugs
mailing list