aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2000-09-06 08:53:45 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2000-09-06 08:53:45 +0000
commitb1ce3eb24a65ac83f1ed5dddaf9e1f04afafd41f (patch)
treec1e9b025eaee66a870950a4c257ec16d85a3ec4f /gcc
parent2a4bbffab1e0bf165757e2897151c08275bfadd4 (diff)
downloadgcc-b1ce3eb24a65ac83f1ed5dddaf9e1f04afafd41f.zip
gcc-b1ce3eb24a65ac83f1ed5dddaf9e1f04afafd41f.tar.gz
gcc-b1ce3eb24a65ac83f1ed5dddaf9e1f04afafd41f.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/class.c9
-rw-r--r--gcc/cp/decl.c3
-rw-r--r--gcc/cp/decl2.c19
-rw-r--r--gcc/cp/friend.c5
5 files changed, 31 insertions, 14 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index d0a4851..744511a0 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,12 @@
+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.
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index d4c2ad2..de692db 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -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);
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 63c2ea8..8537981 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -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;
}
}
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 7fbd80c..085e352 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -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);
diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c
index 1a4df14..950169a 100644
--- a/gcc/cp/friend.c
+++ b/gcc/cp/friend.c
@@ -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;
}
}