Commit 98c76e3c by Jason Merrill

Support reference types

From-SVN: r8922
parent f2f49259
...@@ -26,9 +26,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -26,9 +26,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "flags.h" #include "flags.h"
#include "convert.h" #include "convert.h"
/* Convert EXPR to some pointer type TYPE. /* Convert EXPR to some pointer or reference type TYPE.
EXPR must be pointer, integer, enumeral, or literal zero; EXPR must be pointer, reference, integer, enumeral, or literal zero;
in other cases error is called. */ in other cases error is called. */
tree tree
...@@ -45,7 +45,7 @@ convert_to_pointer (type, expr) ...@@ -45,7 +45,7 @@ convert_to_pointer (type, expr)
return expr; return expr;
} }
if (form == POINTER_TYPE) if (form == POINTER_TYPE || form == REFERENCE_TYPE)
return build1 (NOP_EXPR, type, expr); return build1 (NOP_EXPR, type, expr);
...@@ -92,7 +92,7 @@ convert_to_real (type, expr) ...@@ -92,7 +92,7 @@ convert_to_real (type, expr)
return convert (type, fold (build1 (REALPART_EXPR, return convert (type, fold (build1 (REALPART_EXPR,
TREE_TYPE (TREE_TYPE (expr)), expr))); TREE_TYPE (TREE_TYPE (expr)), expr)));
if (form == POINTER_TYPE) if (form == POINTER_TYPE || form == REFERENCE_TYPE)
error ("pointer value used where a floating point value was expected"); error ("pointer value used where a floating point value was expected");
else else
error ("aggregate value used where a float was expected"); error ("aggregate value used where a float was expected");
...@@ -120,7 +120,7 @@ convert_to_integer (type, expr) ...@@ -120,7 +120,7 @@ convert_to_integer (type, expr)
register tree intype = TREE_TYPE (expr); register tree intype = TREE_TYPE (expr);
register enum tree_code form = TREE_CODE (intype); register enum tree_code form = TREE_CODE (intype);
if (form == POINTER_TYPE) if (form == POINTER_TYPE || form == REFERENCE_TYPE)
{ {
if (integer_zerop (expr)) if (integer_zerop (expr))
expr = integer_zero_node; expr = integer_zero_node;
...@@ -449,7 +449,7 @@ convert_to_complex (type, expr) ...@@ -449,7 +449,7 @@ convert_to_complex (type, expr)
} }
} }
if (form == POINTER_TYPE) if (form == POINTER_TYPE || form == REFERENCE_TYPE)
error ("pointer value used where a complex was expected"); error ("pointer value used where a complex was expected");
else else
error ("aggregate value used where a complex was expected"); error ("aggregate value used where a complex was expected");
......
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