aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1997-09-01 20:07:22 +0000
committerJason Merrill <jason@gcc.gnu.org>1997-09-01 16:07:22 -0400
commit8e69329a82c45a31e84ef3698ad3e7cbfca1c3a9 (patch)
tree5f10735c6c9f875199a83565eda7caabeac21d8c
parentf3e0ca6c2dd19b89e3a6a8ea654abb06ac05770a (diff)
downloadgcc-8e69329a82c45a31e84ef3698ad3e7cbfca1c3a9.zip
gcc-8e69329a82c45a31e84ef3698ad3e7cbfca1c3a9.tar.gz
gcc-8e69329a82c45a31e84ef3698ad3e7cbfca1c3a9.tar.bz2
* call.c (null_ptr_cst_p): Remove support for (void*)0.
From-SVN: r15022
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/NEWS11
-rw-r--r--gcc/cp/call.c48
3 files changed, 53 insertions, 10 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index d81de38..472affb 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,7 @@
+Thu Aug 28 09:45:23 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (null_ptr_cst_p): Remove support for (void*)0.
+
Wed Aug 27 02:03:34 1997 Jeffrey A Law (law@cygnus.com)
* typeck.c (expand_target_expr): Make definition match declaration.
diff --git a/gcc/cp/NEWS b/gcc/cp/NEWS
index 69fc05f..ecfa34f 100644
--- a/gcc/cp/NEWS
+++ b/gcc/cp/NEWS
@@ -7,7 +7,9 @@
for more information.
-* New flags -Wsign-promo, -Wno-pmf-conversion.
+* New flags -Wsign-promo (warn about potentially confusing promotions in
+ overload resolution), -Wno-pmf-conversion (don't warn about converting
+ from a bound member function pointer to function pointer).
* local static variables in extern inline functions will be shared between
translation units.
@@ -65,7 +67,7 @@
already has virtual functions, only if they override a virtual destructor
in a base class. The compiler will warn if this affects your code.
-* The g++ driver no longer links with libg++ by default; it is now
+* The g++ driver now only links against libstdc++, not libg++; it is
functionally identical to the c++ driver.
* (void *)0 is no longer considered a null pointer constant; NULL in
@@ -102,6 +104,11 @@
+ Syntax errors in templates that are never instantiated will now be
diagnosed.
+ Still not supported:
+
+ + Member templates.
+ + Template template parameters.
+
* Synthesized methods are now emitted in any translation units that need
an out-of-line copy. They are no longer affected by #pragma interface
or #pragma implementation.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 0a83885..26319f6 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -2998,9 +2998,6 @@ null_ptr_cst_p (t)
if (t == null_node
|| integer_zerop (t) && INTEGRAL_TYPE_P (TREE_TYPE (t)))
return 1;
- /* Remove this eventually. */
- if (! pedantic && TREE_TYPE (t) == ptr_type_node && integer_zerop (t))
- return 1;
return 0;
}
@@ -3697,7 +3694,7 @@ add_builtin_candidate (candidates, code, code2, fnname, type1, type2,
{
tree c1 = TREE_TYPE (type1);
tree c2 = (TYPE_PTRMEMFUNC_P (type2)
- ? TYPE_METHOD_BASETYPE (TYPE_PTRMEMFUNC_FN_TYPE (type2))
+ ? TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (type2)))
: TYPE_OFFSET_BASETYPE (TREE_TYPE (type2)));
if (IS_AGGR_TYPE (c1) && DERIVED_FROM_P (c2, c1)
@@ -5658,8 +5655,8 @@ compare_ics (ics1, ics2)
if (TYPE_PTRMEMFUNC_P (to1))
{
- to1 = TYPE_METHOD_BASETYPE (TYPE_PTRMEMFUNC_FN_TYPE (to1));
- from1 = TYPE_METHOD_BASETYPE (TYPE_PTRMEMFUNC_FN_TYPE (from1));
+ to1 = TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (to1)));
+ from1 = TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (from1)));
}
else if (TREE_CODE (main1) != BASE_CONV)
{
@@ -5676,8 +5673,8 @@ compare_ics (ics1, ics2)
if (TYPE_PTRMEMFUNC_P (to2))
{
- to2 = TYPE_METHOD_BASETYPE (TYPE_PTRMEMFUNC_FN_TYPE (to2));
- from2 = TYPE_METHOD_BASETYPE (TYPE_PTRMEMFUNC_FN_TYPE (from2));
+ to2 = TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (to2)));
+ from2 = TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (from2)));
}
else if (TREE_CODE (main1) != BASE_CONV)
{
@@ -5778,6 +5775,20 @@ compare_ics (ics1, ics2)
return 0;
}
+static tree
+source_type (t)
+ tree t;
+{
+ for (;; t = TREE_OPERAND (t, 0))
+ {
+ if (TREE_CODE (t) == USER_CONV
+ || TREE_CODE (t) == AMBIG_CONV
+ || TREE_CODE (t) == IDENTITY_CONV)
+ return TREE_TYPE (t);
+ }
+ my_friendly_abort (1823);
+}
+
/* Compare two candidates for overloading as described in
[over.match.best]. Return values:
@@ -5868,6 +5879,27 @@ joust (cand1, cand2)
}
}
+ /* warn about confusing overload resolution */
+ if (winner && cand1->second_conv
+ && ! DECL_CONSTRUCTOR_P (cand1->fn)
+ && ! DECL_CONSTRUCTOR_P (cand2->fn))
+ {
+ int comp = compare_ics (cand1->second_conv, cand2->second_conv);
+ if (comp && comp != winner)
+ {
+ struct z_candidate *w, *l;
+ if (winner == 1)
+ w = cand1, l = cand2;
+ else
+ w = cand2, l = cand1;
+ cp_warning ("choosing `%D' over `%D'", w->fn, l->fn);
+ cp_warning (" for conversion from `%T' to `%T'",
+ TREE_TYPE (source_type (TREE_VEC_ELT (w->convs, 0))),
+ TREE_TYPE (w->second_conv));
+ cp_warning (" because conversion sequence for `this' argument is better");
+ }
+ }
+
if (winner)
return winner;