aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2019-05-07 18:37:19 -0400
committerJason Merrill <jason@gcc.gnu.org>2019-05-07 18:37:19 -0400
commit7f16ac89313843929da15e0d7dceefb85992da2e (patch)
tree82869efd8838e8b1221be15780bb40bded03e106 /gcc
parent258195f165f69c31c953716ece6e0922b651cd5b (diff)
downloadgcc-7f16ac89313843929da15e0d7dceefb85992da2e.zip
gcc-7f16ac89313843929da15e0d7dceefb85992da2e.tar.gz
gcc-7f16ac89313843929da15e0d7dceefb85992da2e.tar.bz2
PR c++/86485 - -Wmaybe-unused with empty class ?:
* typeck.c (build_static_cast_1): Use cp_build_addr_expr. For GCC 9 I fixed this bug with a patch to gimplify_cond_expr, but this function was also doing the wrong thing. Using build_address does not push the ADDR_EXPR down into the arms of a COND_EXPR, which we need for proper handling of conversion of an lvalue ?: to another reference type. From-SVN: r270985
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/typeck.c5
2 files changed, 6 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index bd0914b..d90cc09 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2019-05-07 Jason Merrill <jason@redhat.com>
+ PR c++/86485 - -Wmaybe-unused with empty class ?:
+ * typeck.c (build_static_cast_1): Use cp_build_addr_expr.
+
* pt.c (type_dependent_expression_p): A non-type template parm with
a placeholder type is type-dependent.
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index c107a32..f039a3b 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -5916,7 +5916,8 @@ condition_conversion (tree expr)
}
/* Returns the address of T. This function will fold away
- ADDR_EXPR of INDIRECT_REF. */
+ ADDR_EXPR of INDIRECT_REF. This is only for low-level usage;
+ most places should use cp_build_addr_expr instead. */
tree
build_address (tree t)
@@ -7114,7 +7115,7 @@ build_static_cast_1 (tree type, tree expr, bool c_cast_p,
base = lookup_base (TREE_TYPE (type), intype,
c_cast_p ? ba_unique : ba_check,
NULL, complain);
- expr = build_address (expr);
+ expr = cp_build_addr_expr (expr, complain);
if (sanitize_flags_p (SANITIZE_VPTR))
{