+2002-03-12 Jason Merrill <jason@redhat.com>
+
+ * c-typeck.c (convert_for_assignment): Don't allow conversions
+ between pointers and references. Only allow lvalues to convert to
+ reference.
+
2002-03-13 Hartmut Penner <hpenner@de.ibm.com>
* config/s390/s390.h (PROFILE_BEFORE_PROLOGUE): Emit profile code
if (codel == REFERENCE_TYPE
&& comptypes (TREE_TYPE (type), TREE_TYPE (rhs)) == 1)
{
+ if (!lvalue_p (rhs))
+ {
+ error ("cannot pass rvalue to reference parameter");
+ return error_mark_node;
+ }
if (mark_addressable (rhs) == 0)
return error_mark_node;
rhs = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (rhs)), rhs);
/* Conversions among pointers */
else if ((codel == POINTER_TYPE || codel == REFERENCE_TYPE)
- && (coder == POINTER_TYPE || coder == REFERENCE_TYPE))
+ && (coder == codel))
{
tree ttl = TREE_TYPE (type);
tree ttr = TREE_TYPE (rhstype);