[Issue 1730] New: const struct member func return invariant string can't assign to invariant string

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 13 21:52:10 PST 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1730

           Summary: const struct member func return invariant string can't
                    assign to invariant string
           Product: D
           Version: 2.008
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: davidl at 126.com


struct mystruct{
        invariant(char)[] toChars()
        {
                return "asdf";
        }
}
void func(in mystruct s)
{
        invariant(char)[] k=s.toChars;
}

testconst.d(9): function testconst.mystruct.toChars () does not match parameter
types ()
testconst.d(9): Error: s.toChars can only be called on a mutable object, not
const(mystruct)


-- 



More information about the Digitalmars-d-bugs mailing list