Commit a4bbf910 by Paolo Carlini Committed by Paolo Carlini

re PR c++/54984 (Array allocated with new in a template class is default initialised)

/cp
2012-10-26  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/54984
	* init.c (build_new): Don't turn a null *init into a pointer to
	empty vector orig_init.

/testsuite
2012-10-26  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/54984
	* g++.dg/template/new11.C: New.

From-SVN: r192846
parent 39aada70
2012-10-26 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/54984
* init.c (build_new): Don't turn a null *init into a pointer to
empty vector orig_init.
2012-10-25 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/53761
......
......@@ -2911,7 +2911,8 @@ build_new (VEC(tree,gc) **placement, tree type, tree nelts,
orig_placement = make_tree_vector_copy (*placement);
orig_nelts = nelts;
orig_init = make_tree_vector_copy (*init);
if (*init)
orig_init = make_tree_vector_copy (*init);
make_args_non_dependent (*placement);
if (nelts)
......
2012-10-26 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/54984
* g++.dg/template/new11.C: New.
2012-10-26 Richard Biener <rguenther@suse.de>
PR middle-end/54824
......
// PR c++/54984
// { dg-do run }
int n = 1;
void* operator new(__SIZE_TYPE__)
{
n = -1;
return &n;
}
template <class T>
struct Foo
{
Foo()
: x(new int)
{
if (*x != -1)
__builtin_abort();
}
int* x;
};
int main()
{
Foo<float> foo;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment