www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Is this a bug?

reply "Rene Zwanenburg" <renezwanenburg gmail.com> writes:
The following fails to compile with an 'cannot deduce function 
from argument types' error. When using an array of something 
other than TypeInfo_Class everything works as expected.

void main()
{
	import std.algorithm.mutation : remove;
	
	TypeInfo_Class[] arr;
	TypeInfo_Class c;
	arr = arr.remove!(a => a is c);
}
Sep 11 2015
parent reply anonymous <anonymous example.com> writes:
On Friday 11 September 2015 12:33, Rene Zwanenburg wrote:

 The following fails to compile with an 'cannot deduce function 
 from argument types' error. When using an array of something 
 other than TypeInfo_Class everything works as expected.
 
 void main()
 {
 	import std.algorithm.mutation : remove;
 	
 	TypeInfo_Class[] arr;
 	TypeInfo_Class c;
 	arr = arr.remove!(a => a is c);
 }
Yes, it's a bug. It should work. The problem is that TypeInfo_Class has a method called "init" which shadows the built-in type property of the same name. This confuses ElementType. I filed a bug: https://issues.dlang.org/show_bug.cgi?id=15037
Sep 11 2015
parent "Rene Zwanenburg" <renezwanenburg gmail.com> writes:
On Friday, 11 September 2015 at 11:26:49 UTC, anonymous wrote:
 On Friday 11 September 2015 12:33, Rene Zwanenburg wrote:

 The following fails to compile with an 'cannot deduce function 
 from argument types' error. When using an array of something 
 other than TypeInfo_Class everything works as expected.
 
 void main()
 {
 	import std.algorithm.mutation : remove;
 
 	TypeInfo_Class[] arr;
 	TypeInfo_Class c;
 	arr = arr.remove!(a => a is c);
 }
Yes, it's a bug. It should work. The problem is that TypeInfo_Class has a method called "init" which shadows the built-in type property of the same name. This confuses ElementType. I filed a bug: https://issues.dlang.org/show_bug.cgi?id=15037
Thanks, for both confirming and submitting the issue.
Sep 11 2015