﻿id	summary	reporter	owner	description	type	status	priority	component	version	resolution	keywords	cc
238	Function new incorrectly creates temporary objects	Thierry Delisle		"This code leads to a call to a copy constructor that is incorrect.
{{{
#include <stdlib.hfa>
#include <fstream.hfa>

struct cluster {};
void ?{}(cluster & this) { sout | ""Cluster Ctor""; }
void ?{}(cluster & this, cluster ) { sout | ""Cluster CopyCtor""; }

struct inner {
	cluster * cl;
};
void ?{}(inner & this, cluster & ) { sout | ""Inner Ctor""; }

struct outer {
	inner * in;
};
void ?{}(outer & this, cluster & cl ) {
	this.in = new(cl);
}
void ^?{}(outer & this) { delete(this.in); }

int main() {
	cluster cl;
	outer o = { cl };
}
}}}

The output is: 
{{{
Cluster Ctor
Cluster CopyCtor
Inner Ctor
}}}
but the CopyCtor should not be called."	defect	new	critical	cfa-cc	1.0		new	
