Commit eaa9d009 by Jason Merrill Committed by Jason Merrill

re PR c++/44045 (initialization of array of shared_ptr's with initializer list…

re PR c++/44045 (initialization of array of shared_ptr's with initializer list causes compiler segfault)

	PR c++/44045
	* typeck.c (cp_build_modify_expr): Complain about assignment to
	array from init list.

From-SVN: r159243
parent 34655c9e
2010-05-10 Jason Merrill <jason@redhat.com>
PR c++/44045
* typeck.c (cp_build_modify_expr): Complain about assignment to
array from init list.
2010-05-10 Fabien Chêne <fabien.chene@gmail.com>
PR c++/43719
......
......@@ -6634,6 +6634,12 @@ cp_build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs,
if (BRACE_ENCLOSED_INITIALIZER_P (newrhs))
{
if (modifycode != INIT_EXPR)
{
if (complain & tf_error)
error ("assigning to an array from an initializer list");
return error_mark_node;
}
if (check_array_initializer (lhs, lhstype, newrhs))
return error_mark_node;
newrhs = digest_init (lhstype, newrhs);
......
2010-05-10 Jason Merrill <jason@redhat.com>
PR c++/44045
* g++.dg/cpp0x/initlist33.C: New.
* g++.dg/cpp0x/initlist26.C: Adjust.
* g++.dg/cpp0x/initlist28.C: Adjust.
2010-05-10 Fabien Chêne <fabien.chene@gmail.com>
PR c++/43719
......
......@@ -6,5 +6,5 @@ void
foo (int i)
{
int a[i];
a = { }; // { dg-error "may not be initialized" }
a = { }; // { dg-error "assign" }
}
......@@ -4,5 +4,5 @@
void foo()
{
int a[1];
throw a = {}; // { dg-error "invalid use of non-lvalue array" }
throw a = {}; // { dg-error "assign" }
}
// PR c++/44045
// { dg-options "-std=c++0x" }
struct base
{
virtual ~base() { }
};
int main()
{
base ptr_array[1];
ptr_array = { base() }; // { dg-error "assign" }
}
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