aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2019-08-08 15:37:46 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2019-08-08 15:37:46 +0000
commit60bb944817d35ec0f01e5b78a5f248dabad8b7ca (patch)
tree85ce587499a5cec5d05052d0365b5c3ba3d177a4 /gcc/cp
parent7c81497574411797ac55b9abfab1275bf3241078 (diff)
downloadgcc-60bb944817d35ec0f01e5b78a5f248dabad8b7ca.zip
gcc-60bb944817d35ec0f01e5b78a5f248dabad8b7ca.tar.gz
gcc-60bb944817d35ec0f01e5b78a5f248dabad8b7ca.tar.bz2
PR c++/87519 - bogus warning with -Wsign-conversion.
* typeck.c (cp_build_binary_op): Use same_type_p instead of comparing the types directly. * g++.dg/warn/Wsign-conversion-5.C: New test. From-SVN: r274211
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/typeck.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3af901c..4d78888 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2019-08-08 Marek Polacek <polacek@redhat.com>
+ PR c++/87519 - bogus warning with -Wsign-conversion.
+ * typeck.c (cp_build_binary_op): Use same_type_p instead of comparing
+ the types directly.
+
* constexpr.c (inline_asm_in_constexpr_error): New.
(cxx_eval_constant_expression) <case ASM_EXPR>: Call it.
(potential_constant_expression_1) <case ASM_EXPR>: Likewise.
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 7e4ea3b..4cc0ee0 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -5509,9 +5509,9 @@ cp_build_binary_op (const op_location_t &location,
if (! converted)
{
warning_sentinel w (warn_sign_conversion, short_compare);
- if (TREE_TYPE (op0) != result_type)
+ if (!same_type_p (TREE_TYPE (op0), result_type))
op0 = cp_convert_and_check (result_type, op0, complain);
- if (TREE_TYPE (op1) != result_type)
+ if (!same_type_p (TREE_TYPE (op1), result_type))
op1 = cp_convert_and_check (result_type, op1, complain);
if (op0 == error_mark_node || op1 == error_mark_node)