Compiler fails to detect incorrect variable declaration in QueryInterface method
Original Reporter info from Mantis: toddm
-
Reporter name:
Original Reporter info from Mantis: toddm
- Reporter name:
Description:
If the variable passed to QueryInterface() does not match the specified interface iid, the compiler does not complain. It should fail.
In the example provided below, the variable "Enumerator" is declared as type IEnumerator. However IDispatch is given as the parameter to QueryInterface().
Steps to reproduce:
Compile this code.
TTestEnumerable = class(TAggregatedObject,IEnumerable)
public
function GetEnumerator: IEnumerator;
end;
function TTestEnumerable.GetEnumerator : IEnumerator;
var
Enumerator : IEnumerator;
begin
Controller.QueryInterface(IDispatch,Enumerator);
Result := Enumerator;
end;
Mantis conversion info:
- Mantis ID: 19537
- Version: 2.4.3