+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.
/* 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);
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;
}
}
/* 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. */
};
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);
&& 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;
}
}