OSDN Git Service

* target.h (invalid_conversion, invalid_unary_op,
[pf3gnuchains/gcc-fork.git] / gcc / cp / typeck.c
index ca45527..32d3f04 100644 (file)
@@ -17,8 +17,8 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
 
 
 /* This file is part of the C++ front end.
@@ -2498,7 +2498,8 @@ build_function_call (tree function, tree params)
   /* Check for errors in format strings and inappropriately
      null parameters.  */
 
-  check_function_arguments (TYPE_ATTRIBUTES (fntype), coerced_params);
+  check_function_arguments (TYPE_ATTRIBUTES (fntype), coerced_params,
+                           TYPE_ARG_TYPES (fntype));
 
   return build_cxx_call (function, coerced_params);
 }
@@ -2735,6 +2736,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
   tree op0, op1;
   enum tree_code code0, code1;
   tree type0, type1;
+  const char *invalid_op_diag;
 
   /* Expression code to give to the expression when it is built.
      Normally this is CODE, which is what the caller asked for,
@@ -2844,6 +2846,13 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
   if (code0 == ERROR_MARK || code1 == ERROR_MARK)
     return error_mark_node;
 
+  if ((invalid_op_diag
+       = targetm.invalid_binary_op (code, type0, type1)))
+    {
+      error (invalid_op_diag);
+      return error_mark_node;
+    }
+
   switch (code)
     {
     case PLUS_EXPR:
@@ -3724,10 +3733,21 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert)
   tree argtype = 0;
   const char *errstring = NULL;
   tree val;
+  const char *invalid_op_diag;
 
   if (arg == error_mark_node)
     return error_mark_node;
 
+  if ((invalid_op_diag
+       = targetm.invalid_unary_op ((code == UNARY_PLUS_EXPR
+                                   ? CONVERT_EXPR
+                                   : code),
+                                  TREE_TYPE (xarg))))
+    {
+      error (invalid_op_diag);
+      return error_mark_node;
+    }
+
   switch (code)
     {
     case UNARY_PLUS_EXPR: