mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-07 13:29:16 +08:00
decl.c (cplus_expand_expr_stmt): Promote warning about naked member function reference to error.
* decl.c (cplus_expand_expr_stmt): Promote warning about naked member function reference to error. * cvt.c (ocp_convert): Complain about converting an overloaded function to void. * init.c (build_offset_ref): Just return a lone static member function. * decl.c (cp_finish_decl): Only complain about real CONSTRUCTORs, not internal ones. * typeck.c (build_binary_op_nodefault): Improve error handling. * decl.c (grokfndecl): Complain about making 'main' a template. * typeck.c (string_conv_p): Don't convert from wchar_t[] to char*. * call.c (build_method_call): Handle a BIT_NOT_EXPR around a TYPE_DECL in a template. * typeck2.c (my_friendly_abort): Add URL in the other case, too. From-SVN: r23673
This commit is contained in:
parent
1f288b3fa1
commit
848b92e1cc
@ -1,5 +1,29 @@
|
||||
1998-11-16 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* decl.c (cplus_expand_expr_stmt): Promote warning about naked
|
||||
member function reference to error.
|
||||
* cvt.c (ocp_convert): Complain about converting an overloaded
|
||||
function to void.
|
||||
|
||||
* init.c (build_offset_ref): Just return a lone static member
|
||||
function.
|
||||
|
||||
* decl.c (cp_finish_decl): Only complain about real CONSTRUCTORs,
|
||||
not internal ones.
|
||||
|
||||
* typeck.c (build_binary_op_nodefault): Improve error handling.
|
||||
|
||||
* decl.c (grokfndecl): Complain about making 'main' a template.
|
||||
|
||||
* typeck.c (string_conv_p): Don't convert from wchar_t[] to char*.
|
||||
|
||||
* call.c (build_method_call): Handle a BIT_NOT_EXPR around a
|
||||
TYPE_DECL in a template.
|
||||
|
||||
1998-11-15 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* typeck2.c (my_friendly_abort): Add URL in the other case, too.
|
||||
|
||||
* decl.c (struct cp_function): Add named_label_uses.
|
||||
(push_cp_function_context): Save it.
|
||||
(pop_cp_function_context): Restore it.
|
||||
|
@ -625,10 +625,15 @@ build_method_call (instance, name, parms, basetype_path, flags)
|
||||
{
|
||||
/* We need to process template parm names here so that tsubst catches
|
||||
them properly. Other type names can wait. */
|
||||
if (TREE_CODE (name) == BIT_NOT_EXPR
|
||||
&& TREE_CODE (TREE_OPERAND (name, 0)) == IDENTIFIER_NODE)
|
||||
if (TREE_CODE (name) == BIT_NOT_EXPR)
|
||||
{
|
||||
tree type = get_aggr_from_typedef (TREE_OPERAND (name, 0), 0);
|
||||
tree type = NULL_TREE;
|
||||
|
||||
if (TREE_CODE (TREE_OPERAND (name, 0)) == IDENTIFIER_NODE)
|
||||
type = get_aggr_from_typedef (TREE_OPERAND (name, 0), 0);
|
||||
else if (TREE_CODE (TREE_OPERAND (name, 0)) == TYPE_DECL)
|
||||
type = TREE_TYPE (TREE_OPERAND (name, 0));
|
||||
|
||||
if (type && TREE_CODE (type) == TEMPLATE_TYPE_PARM)
|
||||
name = build_min_nt (BIT_NOT_EXPR, type);
|
||||
}
|
||||
|
@ -683,7 +683,12 @@ ocp_convert (type, expr, convtype, flags)
|
||||
}
|
||||
|
||||
if (code == VOID_TYPE && (convtype & CONV_STATIC))
|
||||
return build1 (CONVERT_EXPR, type, e);
|
||||
{
|
||||
if (type_unknown_p (e))
|
||||
error ("address of overloaded function with no contextual type information");
|
||||
|
||||
return build1 (CONVERT_EXPR, type, e);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* This is incorrect. A truncation can't be stripped this way.
|
||||
|
@ -7217,7 +7217,8 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
|
||||
{
|
||||
if (TREE_CODE (type) == ARRAY_TYPE)
|
||||
init = digest_init (type, init, (tree *) 0);
|
||||
else if (TREE_CODE (init) == CONSTRUCTOR)
|
||||
else if (TREE_CODE (init) == CONSTRUCTOR
|
||||
&& TREE_HAS_CONSTRUCTOR (init))
|
||||
{
|
||||
if (TYPE_NON_AGGREGATE_CLASS (type))
|
||||
{
|
||||
@ -8073,6 +8074,8 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
|
||||
|
||||
if (ctype == NULL_TREE && DECL_MAIN_P (decl))
|
||||
{
|
||||
if (processing_template_decl)
|
||||
error ("cannot declare `main' to be a template");
|
||||
if (inlinep)
|
||||
error ("cannot declare `main' to be inline");
|
||||
else if (! publicp)
|
||||
@ -13891,7 +13894,7 @@ cplus_expand_expr_stmt (exp)
|
||||
if (TREE_CODE (exp) == ADDR_EXPR || TREE_CODE (exp) == TREE_LIST)
|
||||
error ("address of overloaded function with no contextual type information");
|
||||
else if (TREE_CODE (exp) == COMPONENT_REF)
|
||||
warning ("useless reference to a member function name, did you forget the ()?");
|
||||
error ("invalid reference to a member function name, did you forget the ()?");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1618,6 +1618,8 @@ build_offset_ref (type, name)
|
||||
return error_mark_node;
|
||||
}
|
||||
mark_used (t);
|
||||
if (DECL_STATIC_FUNCTION_P (t))
|
||||
return t;
|
||||
return build (OFFSET_REF, TREE_TYPE (t), decl, t);
|
||||
}
|
||||
|
||||
|
@ -1769,8 +1769,15 @@ string_conv_p (totype, exp, warn)
|
||||
&& !same_type_p (t, wchar_type_node))
|
||||
return 0;
|
||||
|
||||
if (TREE_CODE (exp) != STRING_CST)
|
||||
if (TREE_CODE (exp) == STRING_CST)
|
||||
{
|
||||
/* Make sure that we don't try to convert between char and wchar_t. */
|
||||
if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (exp))) != t)
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Is this a string constant which has decayed to 'const char *'? */
|
||||
t = build_pointer_type (build_qualified_type (t, TYPE_QUAL_CONST));
|
||||
if (!same_type_p (TREE_TYPE (exp), t))
|
||||
return 0;
|
||||
@ -1782,7 +1789,7 @@ string_conv_p (totype, exp, warn)
|
||||
|
||||
/* This warning is not very useful, as it complains about printf. */
|
||||
if (warn && warn_write_strings)
|
||||
cp_warning ("deprecated conversion from string constant to `char *'");
|
||||
cp_warning ("deprecated conversion from string constant to `%T'", totype);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -3938,6 +3945,9 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
|
||||
op0 = cp_convert (result_type, op0);
|
||||
if (TREE_TYPE (op1) != result_type)
|
||||
op1 = cp_convert (result_type, op1);
|
||||
|
||||
if (op0 == error_mark_node || op1 == error_mark_node)
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
if (build_type == NULL_TREE)
|
||||
|
@ -396,6 +396,7 @@ my_friendly_abort (i)
|
||||
error ("Internal compiler error %d.", i);
|
||||
|
||||
fatal ("Please submit a full bug report to `egcs-bugs@cygnus.com'.");
|
||||
fatal ("See <URL:http://egcs.cygnus.com/faq.html#bugreport> for details.");
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user