﻿id	summary	reporter	owner	description	type	status	priority	component	version	resolution	keywords	cc
202	Type manipulation in long chains of post-fix functions	m3zulfiq		"In the code below, ndp1 initialization goes to the wrong polymorphic version of function xalloc. Although, nip1 and ndp0 initializations work fine.
The only difference between ndp0 and ndp1 is the length of the chain of postfix functions.

forall( dtype T | sized(T) ) {
	struct S1 { T * oaddr; bool copy;};

	T * 	?`post_2(S1(T) in) 		{ return (T*)0p; }
	S1(T) 	?`post_1(S1(T) in) 		{ return (S1(T)){(T*)in.oaddr}; }
	S1(T) 	?`xalloc (T * in) 		{ printf(""TT ""); return (S1(T)){(T*)in}; }

	forall( dtype S | sized(S) ) {
		S1(T) 	?`xalloc (S * in) 		{ printf(""TS ""); return (S1(T)){(T*)in}; }
	}
}

int main() {
	int * ip = malloc(4);
	int * nip0 = ip`xalloc`post_2;				// prints TT
	int * nip1 = ip`xalloc`post_1`post_2;		// prints TT
	double * ndp0 = ip`xalloc`post_2;			// prints TS
	double * ndp1 = ip`xalloc`post_1`post_2;	// prints TT but should TS
	return 0;
}"	defect	new	major	cfa-cc	1.0		postfix, type, polymorphic, function	
