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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@23673
138bc75d-0d04-0410-961f-
82ee72b054a4
+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.
{
/* 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);
}
}
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.
{
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))
{
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)
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
{
return error_mark_node;
}
mark_used (t);
+ if (DECL_STATIC_FUNCTION_P (t))
+ return t;
return build (OFFSET_REF, TREE_TYPE (t), decl, t);
}
&& !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;
/* 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;
}
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)
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