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

Daniel Donnelly enjoysmath at gmail.com
Tue Mar 27 01:02:17 PDT 2012


I have: [code]

         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;
	}
[/code]

Compile: dmd A

Compile Output:
A.d(23): Error: function A.B.dup () immutable is not callable 
using argument types ()


More information about the Digitalmars-d mailing list