Commit d478f1e4 by Jason Merrill Committed by Jason Merrill

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
parent 6864d849
2017-04-17 Jason Merrill <jason@redhat.com> 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. * pt.c (tsubst_init): Set TARGET_EXPR_DIRECT_INIT_P.
2017-04-15 Alexandre Oliva <aoliva@redhat.com> 2017-04-15 Alexandre Oliva <aoliva@redhat.com>
......
...@@ -4677,7 +4677,7 @@ enum cp_lvalue_kind_flags { ...@@ -4677,7 +4677,7 @@ enum cp_lvalue_kind_flags {
clk_none = 0, /* Things that are not an lvalue. */ clk_none = 0, /* Things that are not an lvalue. */
clk_ordinary = 1, /* An ordinary lvalue. */ clk_ordinary = 1, /* An ordinary lvalue. */
clk_rvalueref = 2,/* An xvalue (rvalue formed using an rvalue reference) */ 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_bitfield = 8, /* An lvalue for a bit-field. */
clk_packed = 16 /* An lvalue for a packed field. */ clk_packed = 16 /* An lvalue for a packed field. */
}; };
......
...@@ -243,7 +243,8 @@ lvalue_kind (const_tree ref) ...@@ -243,7 +243,8 @@ lvalue_kind (const_tree ref)
default: default:
if (!TREE_TYPE (ref)) if (!TREE_TYPE (ref))
return clk_none; 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; return clk_class;
break; break;
} }
......
// PR c++/80415
// { dg-do compile { target c++11 } }
struct A {
A(int, int, const int (&)[1] = {});
};
A fn1() { return {0, 0}; }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment