* typeck.c (cp_build_modify_expr): Complain about assignment to
array from init list.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159243
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
2010-05-10 Fabien Chêne <fabien.chene@gmail.com>
PR c++/43719
if (BRACE_ENCLOSED_INITIALIZER_P (newrhs))
{
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);
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
2010-05-10 Fabien Chêne <fabien.chene@gmail.com>
PR c++/43719
- a = { }; // { dg-error "may not be initialized" }
+ a = { }; // { dg-error "assign" }
- throw a = {}; // { dg-error "invalid use of non-lvalue array" }
+ throw a = {}; // { dg-error "assign" }
--- /dev/null
+// PR c++/44045
+// { dg-options "-std=c++0x" }
+
+struct base
+{
+ virtual ~base() { }
+};
+
+int main()
+{
+ base ptr_array[1];
+ ptr_array = { base() }; // { dg-error "assign" }
+}