call.c (reference_binding): Allow direct binding to an array rvalue.

* call.c (reference_binding): Allow direct binding to an array
	rvalue.

From-SVN: r171613
This commit is contained in:
Jason Merrill 2011-03-28 12:14:12 -04:00 committed by Jason Merrill
parent c1120b0cd2
commit 159177a154
4 changed files with 13 additions and 1 deletions

View File

@ -1,5 +1,8 @@
2011-03-28 Jason Merrill <jason@redhat.com>
* call.c (reference_binding): Allow direct binding to an array
rvalue.
Core 898
* parser.c (cp_parser_compound_statement): Add function_body parm.
Complain about non-body compound-stmt in constexpr fn.

View File

@ -1429,7 +1429,9 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags)
|| (((CP_TYPE_CONST_NON_VOLATILE_P (to)
&& !(flags & LOOKUP_NO_TEMP_BIND))
|| TYPE_REF_IS_RVALUE (rto))
&& (CLASS_TYPE_P (from) || (expr && lvalue_p (expr))))))
&& (CLASS_TYPE_P (from)
|| TREE_CODE (from) == ARRAY_TYPE
|| (expr && lvalue_p (expr))))))
{
/* [dcl.init.ref]

View File

@ -1,5 +1,7 @@
2011-03-28 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/initlist-array1.C: New.
* g++.dg/cpp0x/constexpr-compound.C: New.
* g++.dg/cpp0x/constexpr-using.C: New.

View File

@ -0,0 +1,5 @@
// { dg-options -std=c++0x }
typedef int IRT[2];
const IRT& ir = IRT{1,2};