* 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.
From-SVN: r18908
+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
{
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);
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;
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;
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'. */
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;
}
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)
&& (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))