Commit b1ce3eb2 by Nathan Sidwell Committed by Nathan Sidwell

class.c (resolve_address_of_overloaded_function): Add explanation message.

	* class.c (resolve_address_of_overloaded_function): Add
	explanation message.
	* decl.c (define_case_label): Reformat explanation.
	* decl2.c (finish_static_data_member_decl): Likewise.
	(grokfield): Likewise.
	* friend.c (do_friend): Likewise.

From-SVN: r36188
parent 2a4bbffa
2000-09-06 Nathan Sidwell <nathan@codesourcery.com>
* class.c (resolve_address_of_overloaded_function): Add
explanation message.
* decl.c (define_case_label): Reformat explanation.
* decl2.c (finish_static_data_member_decl): Likewise.
(grokfield): Likewise.
* friend.c (do_friend): Likewise.
2000-09-05 Zack Weinberg <zack@wolery.cumb.org>
* tree.c (walk_tree): Expose tail recursion.
......
......@@ -5965,13 +5965,20 @@ resolve_address_of_overloaded_function (target_type,
/* Good, exactly one match. Now, convert it to the correct type. */
fn = TREE_PURPOSE (matches);
if (TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE
if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)
&& !ptrmem && !flag_ms_extensions)
{
static int explained;
if (!complain)
return error_mark_node;
cp_pedwarn ("assuming pointer to member `%D'", fn);
if (!explained)
{
cp_pedwarn ("(a pointer to member can only be formed with `&%E')", fn);
explained = 1;
}
}
mark_used (fn);
......
......@@ -5227,8 +5227,7 @@ define_case_label ()
warning ("where case label appears here");
if (!explained)
{
warning ("(enclose actions of previous case statements requiring");
warning ("destructors in their own binding contours.)");
warning ("(enclose actions of previous case statements requiring destructors in their own scope.)");
explained = 1;
}
}
......
......@@ -1597,12 +1597,15 @@ finish_static_data_member_decl (decl, init, asmspec_tree, flags)
/* Static consts need not be initialized in the class definition. */
if (init != NULL_TREE && TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl)))
{
static int explanation = 0;
static int explained = 0;
error ("initializer invalid for static member with constructor");
if (explanation++ == 0)
error ("(you really want to initialize it separately)");
init = 0;
if (!explained)
{
error ("(an out of class initialization is required)");
explained = 1;
}
init = NULL_TREE;
}
/* Force the compiler to know when an uninitialized static const
member is being used. */
......@@ -1656,13 +1659,13 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
};
Explain that to the user. */
static int explained_p;
static int explained;
cp_error ("invalid data member initiailization");
if (!explained_p)
if (!explained)
{
cp_error ("use `=' to initialize static data members");
explained_p = 1;
cp_error ("(use `=' to initialize static data members)");
explained = 1;
}
declarator = TREE_OPERAND (declarator, 0);
......
......@@ -399,11 +399,10 @@ do_friend (ctype, declarator, decl, parmdecls, attrlist,
&& current_template_parms && uses_template_parms (decl))
{
static int explained;
cp_warning ("friend declaration `%#D'", decl);
warning (" declares a non-template function");
cp_warning ("friend declaration `%#D' declares a non-template function", decl);
if (! explained)
{
warning (" (if this is not what you intended, make sure the function template has already been declared and add <> after the function name here) -Wno-non-template-friend disables this warning.");
warning ("(if this is not what you intended, make sure the function template has already been declared and add <> after the function name here) -Wno-non-template-friend disables this warning.");
explained = 1;
}
}
......
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