Commit 7bae46f4 by Jason Merrill Committed by Jason Merrill

call.c (build_method_call): Handle non-scoped destructors, too.

	* 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
parent e18db50d
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
......
......@@ -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);
......
......@@ -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;
......
......@@ -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)
......
......@@ -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))
......
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