diff options
author | Jason Merrill <jason@redhat.com> | 2010-05-10 14:37:56 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2010-05-10 14:37:56 -0400 |
commit | eaa9d009d8563f4224f58e982a962662d3b5ea06 (patch) | |
tree | c22516bdca0cac3cfcac3c2e9b60621bf52287c6 /gcc/cp/typeck.c | |
parent | 34655c9e682dcc87387798714a8ad812a0427299 (diff) | |
download | gcc-eaa9d009d8563f4224f58e982a962662d3b5ea06.zip gcc-eaa9d009d8563f4224f58e982a962662d3b5ea06.tar.gz gcc-eaa9d009d8563f4224f58e982a962662d3b5ea06.tar.bz2 |
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
Diffstat (limited to 'gcc/cp/typeck.c')
-rw-r--r-- | gcc/cp/typeck.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 61d5f22..5c8fd826 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -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); |