PR c++/60224
* decl.c (cp_complete_array_type, maybe_deduce_size_from_array_init):
Don't get confused by a CONSTRUCTOR that already has a type.
From-SVN: r208002
2014-02-21 Jason Merrill <jason@redhat.com>
+ PR c++/60224
+ * decl.c (cp_complete_array_type, maybe_deduce_size_from_array_init):
+ Don't get confused by a CONSTRUCTOR that already has a type.
+
PR c++/60277
* call.c (build_array_conv): Don't crash on VLA.
those are not supported in GNU C++, and as the middle-end
will crash if presented with a non-numeric designated
initializer. */
- if (initializer && TREE_CODE (initializer) == CONSTRUCTOR)
+ if (initializer && BRACE_ENCLOSED_INITIALIZER_P (initializer))
{
vec<constructor_elt, va_gc> *v = CONSTRUCTOR_ELTS (initializer);
constructor_elt *ce;
int failure;
tree type, elt_type;
+ /* Don't get confused by a CONSTRUCTOR for some other type. */
+ if (initial_value && TREE_CODE (initial_value) == CONSTRUCTOR
+ && !BRACE_ENCLOSED_INITIALIZER_P (initial_value))
+ return 1;
+
if (initial_value)
{
unsigned HOST_WIDE_INT i;
--- /dev/null
+// PR c++/60224
+
+struct A {};
+
+void foo()
+{
+ bool b[] = (int (A::*)())0; // { dg-error "" }
+}