* tree.c (lvalue_kind): Return clk_class for an array prvalue.
From-SVN: r246954
2017-04-17 Jason Merrill <jason@redhat.com>
+ PR c++/80415 - wrong error with default arg and array reference.
+ * tree.c (lvalue_kind): Return clk_class for an array prvalue.
+
* pt.c (tsubst_init): Set TARGET_EXPR_DIRECT_INIT_P.
2017-04-15 Alexandre Oliva <aoliva@redhat.com>
clk_none = 0, /* Things that are not an lvalue. */
clk_ordinary = 1, /* An ordinary lvalue. */
clk_rvalueref = 2,/* An xvalue (rvalue formed using an rvalue reference) */
- clk_class = 4, /* A prvalue of class-type. */
+ clk_class = 4, /* A prvalue of class or array type. */
clk_bitfield = 8, /* An lvalue for a bit-field. */
clk_packed = 16 /* An lvalue for a packed field. */
};
default:
if (!TREE_TYPE (ref))
return clk_none;
- if (CLASS_TYPE_P (TREE_TYPE (ref)))
+ if (CLASS_TYPE_P (TREE_TYPE (ref))
+ || TREE_CODE (TREE_TYPE (ref)) == ARRAY_TYPE)
return clk_class;
break;
}
--- /dev/null
+// PR c++/80415
+// { dg-do compile { target c++11 } }
+
+struct A {
+ A(int, int, const int (&)[1] = {});
+};
+A fn1() { return {0, 0}; }