diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/cp/call.c | 5 | ||||
-rw-r--r-- | gcc/cp/friend.c | 3 | ||||
-rw-r--r-- | gcc/cp/pt.c | 41 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 3 |
5 files changed, 45 insertions, 20 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 62780a4..d2f5665 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,16 @@ +Mon Mar 30 08:55:42 1998 Jason Merrill <jason@yorick.cygnus.com> + + * call.c (build_method_call): Handle non-scoped destructors, too. + * pt.c (tsubst_copy): Likewise. + + * pt.c (print_template_context): Split out... + (push_tinst_level): ...from here. + + * friend.c (is_friend): Don't pass a type to decl_function_context. + + * typeck.c (convert_for_initialization): Always hand off + conversions to class type. + Sun Mar 29 20:01:59 1998 Jason Merrill <jason@yorick.cygnus.com> * friend.c (is_friend): Local classes have the same access as the diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 6e56995..d066a58 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -571,8 +571,9 @@ build_method_call (instance, name, parms, basetype_path, flags) { if (TREE_CODE (name) == BIT_NOT_EXPR) { - tree type = get_aggr_from_typedef (TREE_OPERAND (name, 0), 1); - name = build_min_nt (BIT_NOT_EXPR, type); + tree type = get_aggr_from_typedef (TREE_OPERAND (name, 0), 0); + if (type) + name = build_min_nt (BIT_NOT_EXPR, type); } return build_min_nt (METHOD_CALL_EXPR, name, instance, parms, NULL_TREE); diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c index d0e6fef..304936a 100644 --- a/gcc/cp/friend.c +++ b/gcc/cp/friend.c @@ -49,7 +49,8 @@ is_friend (type, supplicant) declp = (TREE_CODE_CLASS (TREE_CODE (supplicant)) == 'd'); /* Local classes have the same access as the enclosing function. */ - context = hack_decl_function_context (supplicant); + context = declp ? supplicant : TYPE_MAIN_DECL (supplicant); + context = hack_decl_function_context (context); if (context) { supplicant = context; diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 893ef2f..4f87928 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -3133,6 +3133,28 @@ extern int max_tinst_depth; int depth_reached = 0; #endif +/* Print out all the template instantiations that we are currently + working on. */ + +void +print_template_context () +{ + struct tinst_level *p = current_tinst_level; + int line = lineno; + char *file = input_filename; + + for (; p; p = p->next) + { + cp_error (" instantiated from `%D'", p->decl); + lineno = p->line; + input_filename = p->file; + } + error (" instantiated from here"); + + lineno = line; + input_filename = file; +} + static int push_tinst_level (d) tree d; @@ -3141,10 +3163,6 @@ push_tinst_level (d) if (tinst_depth >= max_tinst_depth) { - struct tinst_level *p = current_tinst_level; - int line = lineno; - char *file = input_filename; - /* If the instantiation in question still has unbound template parms, we don't really care if we can't instantiate it, so just return. This happens with base instantiation for implicit `typename'. */ @@ -3156,16 +3174,7 @@ push_tinst_level (d) error (" (use -ftemplate-depth-NN to increase the maximum)"); cp_error (" instantiating `%D'", d); - for (; p; p = p->next) - { - cp_error (" instantiated from `%D'", p->decl); - lineno = p->line; - input_filename = p->file; - } - error (" instantiated from here"); - - lineno = line; - input_filename = file; + print_template_context (); return 0; } @@ -4836,7 +4845,9 @@ tsubst_copy (t, args, in_decl) if (TREE_CODE (name) == BIT_NOT_EXPR) { name = tsubst_copy (TREE_OPERAND (name, 0), args, in_decl); - name = build1 (BIT_NOT_EXPR, NULL_TREE, TYPE_MAIN_VARIANT (name)); + if (TREE_CODE (name) != IDENTIFIER_NODE) + name = TYPE_MAIN_VARIANT (name); + name = build1 (BIT_NOT_EXPR, NULL_TREE, name); } else if (TREE_CODE (name) == SCOPE_REF && TREE_CODE (TREE_OPERAND (name, 1)) == BIT_NOT_EXPR) diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 9786dfb..dfcda9a 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -7031,8 +7031,7 @@ convert_for_initialization (exp, type, rhs, flags, errtype, fndecl, parmnum) && (IS_SIGNATURE_POINTER (type) || IS_SIGNATURE_REFERENCE (type))) return build_signature_pointer_constructor (type, rhs); - if (IS_AGGR_TYPE (type) - && (TYPE_NEEDS_CONSTRUCTING (type) || TREE_HAS_CONSTRUCTOR (rhs))) + if (IS_AGGR_TYPE (type)) return ocp_convert (type, rhs, CONV_IMPLICIT|CONV_FORCE_TEMP, flags); if (type == TREE_TYPE (rhs)) |