* call.c (null_ptr_cst_p): Remove support for (void*)0.
authorJason Merrill <jason@yorick.cygnus.com>
Mon, 1 Sep 1997 20:07:22 +0000 (20:07 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 1 Sep 1997 20:07:22 +0000 (16:07 -0400)
From-SVN: r15022

gcc/cp/ChangeLog
gcc/cp/NEWS
gcc/cp/call.c

index d81de386ca9eec6155912499a3d352564c3acb74..472affb2e375cf33fbb391f1f09d910d44a0d8e7 100644 (file)
@@ -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.
index 69fc05f8f29b16f0c38691fd67fbf915c2d98af0..ecfa34ff378f7faf69f2f2b35da8ebc12af9d8ce 100644 (file)
@@ -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
      + 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.
index 0a8388576757cc66d1163c81becec0dd9b6c14b7..26319f61d6d8d984fc52c0164f75cb5c6ecf7ce8 100644 (file)
@@ -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;