immutable method not callable using argument types () - doesn't make sense

kenji hara k.hara.pg at gmail.com
Wed Feb 6 16:18:06 PST 2013


2012/3/27 Daniel Donnelly <enjoysmath at gmail.com>

> I have: [code]
>
>      module A;
>         module A;
>
>         interface B {
>            public:
>                   immutable B dup();
>         }
>
>         class A : B {
>            public:
>                   this() {}
>                   this(in char[] field) { this.field = field.dup; }
>                   immutable A dup() { return new A(field); }
>            private:
>                   char[] field;
>         }
>
>         void main()
>         {
>                 B f, g;
>                 f = new A;
>                 g = new A;
>
>                 f = g.dup;
>         }
>

With git head (2.062alpha):

test.d(21): Error: immutable method test.B.dup is not callable using a
mutable object

Kenji Hara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130207/bb848505/attachment.html>


More information about the Digitalmars-d mailing list