PR c++/80415 - wrong error with default arg and array reference.

* tree.c (lvalue_kind): Return clk_class for an array prvalue.

From-SVN: r246954
This commit is contained in:
Jason Merrill 2017-04-17 15:39:00 -04:00 committed by Jason Merrill
parent 6864d84921
commit d478f1e4c9
4 changed files with 13 additions and 2 deletions

View file

@ -1,5 +1,8 @@
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>

View file

@ -4677,7 +4677,7 @@ enum cp_lvalue_kind_flags {
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. */
};

View file

@ -243,7 +243,8 @@ lvalue_kind (const_tree ref)
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;
}

View file

@ -0,0 +1,7 @@
// PR c++/80415
// { dg-do compile { target c++11 } }
struct A {
A(int, int, const int (&)[1] = {});
};
A fn1() { return {0, 0}; }