diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0049abf9ff0..c30348906ef 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +Mon Oct 20 10:52:22 1997 Jason Merrill + + * decl.c (init_decl_processing): Give null_node unknown* type. + * typeck.c (comp_target_types): Handle UNKNOWN_TYPE. + (common_type): Likewise. + * error.c (args_as_string): Recognize null_node. + Thu Oct 16 15:31:09 1997 Judy Goldberg * pt.c (determine_explicit_specialization): Initialize "dummy" diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 6f1007cda21..59fdbb32757 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4998,11 +4998,6 @@ init_decl_processing () TREE_TYPE (null_pointer_node) = build_pointer_type (void_type_node); layout_type (TREE_TYPE (null_pointer_node)); - if (flag_ansi) - TREE_TYPE (null_node) = type_for_size (POINTER_SIZE, 0); - else - TREE_TYPE (null_node) = build_pointer_type (void_type_node); - /* Used for expressions that do nothing, but are not errors. */ void_zero_node = build_int_2 (0, 0); TREE_TYPE (void_zero_node) = void_type_node; @@ -5315,7 +5310,14 @@ init_decl_processing () TYPE_MODE (unknown_type_node) = TYPE_MODE (void_type_node); /* Indirecting an UNKNOWN_TYPE node yields an UNKNOWN_TYPE node. */ TREE_TYPE (unknown_type_node) = unknown_type_node; - /* Looking up TYPE_POINTER_TO and TYPE_REFERENCE_TO yield the same result. */ + + if (flag_ansi) + TREE_TYPE (null_node) = type_for_size (POINTER_SIZE, 0); + else + TREE_TYPE (null_node) = build_pointer_type (unknown_type_node); + + /* Looking up TYPE_POINTER_TO and TYPE_REFERENCE_TO yield the same + result. */ TYPE_POINTER_TO (unknown_type_node) = unknown_type_node; TYPE_REFERENCE_TO (unknown_type_node) = unknown_type_node; diff --git a/gcc/cp/error.c b/gcc/cp/error.c index bec7bfaa1e4..5128175233f 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -1763,7 +1763,10 @@ args_as_string (p, v) OB_INIT (); for (; p; p = TREE_CHAIN (p)) { - dump_type (error_type (TREE_VALUE (p)), v); + if (TREE_VALUE (p) == null_node) + OB_PUTS ("NULL"); + else + dump_type (error_type (TREE_VALUE (p)), v); if (TREE_CHAIN (p)) OB_PUTS (", "); } diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index d5d4381cbd8..aafea54b1e4 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -451,6 +451,10 @@ common_type (t1, t2) target = tt1; else if (tt1 == void_type_node || tt2 == void_type_node) target = void_type_node; + else if (tt1 == unknown_type_node) + target = tt2; + else if (tt2 == unknown_type_node) + target = tt1; else target = common_type (tt1, tt2); @@ -871,7 +875,10 @@ comp_target_types (ttl, ttr, nptrs) if (nptrs > 0) { - if (TREE_CODE (ttl) == VOID_TYPE + if (TREE_CODE (ttl) == UNKNOWN_TYPE + || TREE_CODE (ttr) == UNKNOWN_TYPE) + return 1; + else if (TREE_CODE (ttl) == VOID_TYPE && TREE_CODE (ttr) != FUNCTION_TYPE && TREE_CODE (ttr) != METHOD_TYPE && TREE_CODE (ttr) != OFFSET_TYPE)