Fixes a crash with parameterized interfaces that have methods containing array argument(s).
``` namespace Test { interface ITest1<T>;
[ uuid(006735f5-5f5d-4c39-9106-e1821b4caf04) ] interface ITest1<T> { void Method1([in] int a, [out, retval, size_is(a)]T *v); }
declare { interface ITest1<int>; } } ```
widl: ../tools/widl/typegen.c:378: enum typegen_type typegen_detect_type(const type_t *, const attr_list_t *, unsigned int): Assertion `0' failed.
-- v2: widl: Fix crash while replacing type parameters for arrays.
From: Vibhav Pant vibhavp@gmail.com
--- tools/widl/typetree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c index 3bfb2efeea2..fefc98f9df6 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c @@ -1195,7 +1195,7 @@ static type_t *replace_type_parameters_in_type(type_t *type, typeref_list_t *ori t = replace_type_parameters_in_type(type->details.array.elem.type, orig, repl); if (t == t->details.array.elem.type) return type; type = duptype(type, 0); - t->details.array.elem.type = t; + type->details.array.elem.type = t; return type; case TYPE_FUNCTION: t = duptype(type, 0);
Rémi Bernon (@rbernon) commented about tools/widl/typetree.c:
t = replace_type_parameters_in_type(type->details.array.elem.type, orig, repl); if (t == t->details.array.elem.type) return type;
```suggestion:-0+0 if (t == type->details.array.elem.type) return type; ``` I guess too.