... with patch ;)
If you are curious where the heck that INDIRECT_REF is coming from, is
coming from the gimplifier, cp_gimpliify_expr, via build_vec_init. Grrr.
Paolo.
///////////////////////
Index: cp/init.c
===================================================================
--- cp/init.c (revision 258758)
+++ cp/init.c (working copy)
@@ -1688,14 +1688,6 @@ build_aggr_init (tree exp, tree init, int flags, t
}
else
{
- /* An array may not be initialized use the parenthesized
- initialization form -- unless the initializer is "()". */
- if (init && TREE_CODE (init) == TREE_LIST)
- {
- if (complain & tf_error)
- error ("bad array initializer");
- return error_mark_node;
- }
/* Must arrange to initialize each element of EXP
from elements of INIT. */
if (cv_qualified_p (type))
@@ -1705,14 +1697,15 @@ build_aggr_init (tree exp, tree init, int flags, t
from_array = (itype && same_type_p (TREE_TYPE (init),
TREE_TYPE (exp)));
- if (init && !from_array
- && !BRACE_ENCLOSED_INITIALIZER_P (init))
+ if (init && ((!from_array
+ && !BRACE_ENCLOSED_INITIALIZER_P (init))
+ /* See c++/84632. */
+ || VAR_P (init)))
{
if (complain & tf_error)
- permerror (init_loc, "array must be initialized "
- "with a brace-enclosed initializer");
- else
- return error_mark_node;
+ error_at (init_loc, "array must be initialized "
+ "with a brace-enclosed initializer");
+ return error_mark_node;
}
}
Index: testsuite/g++.dg/init/array49.C
===================================================================
--- testsuite/g++.dg/init/array49.C (nonexistent)
+++ testsuite/g++.dg/init/array49.C (working copy)
@@ -0,0 +1,6 @@
+// PR c++/84632
+// { dg-additional-options "-w" }
+
+class {
+ &a; // { dg-error "forbids declaration" }
+} b[2] = b; // { dg-error "initialized" }
Index: testsuite/g++.dg/torture/pr70499.C
===================================================================
--- testsuite/g++.dg/torture/pr70499.C (revision 258758)
+++ testsuite/g++.dg/torture/pr70499.C (working copy)
@@ -1,5 +1,5 @@
// { dg-do compile }
-// { dg-additional-options "-w -fpermissive -Wno-psabi" }
+// { dg-additional-options "-w -Wno-psabi" }
// { dg-additional-options "-mavx" { target x86_64-*-* i?86-*-* } }
typedef double __m256d __attribute__ ((__vector_size__ (32), __may_alias__));
@@ -30,7 +30,7 @@ struct Foo {
template<typename Tx>
__attribute__((__always_inline__)) inline void inlineFunc(Tx hx[]) {
Tx x = hx[0], y = hx[1];
- Tx lam[1] = (x*y);
+ Tx lam[1] = {(x*y)};
}
void FooBarFunc () {