A recent question from richi about the C++ FE's use of NOP_EXPR and
CONVERT_EXPR led me to switch these functions to use CONVERT_EXPR
instead, since we don't want STRIP_NOPS to remove them.
Tested x86_64-pc-linux-gnu, applying to trunk.
commit e1215a9814036a16bb97609e97c3402b9b78c84c
Author: Jason Merrill <ja...@redhat.com>
Date: Mon Sep 29 10:50:01 2014 -0400
* method.c (build_stub_object): Use CONVERT_EXPR.
* tree.c (build_dummy_object): Likewise.
(is_dummy_object): Adjust.
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index d0e0105..b427d65 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -852,7 +852,7 @@ build_stub_type (tree type, int quals, bool rvalue)
static tree
build_stub_object (tree reftype)
{
- tree stub = build1 (NOP_EXPR, reftype, integer_one_node);
+ tree stub = build1 (CONVERT_EXPR, reftype, integer_one_node);
return convert_from_reference (stub);
}
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index a7bb38b..2247eb5 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2979,7 +2979,7 @@ member_p (const_tree decl)
tree
build_dummy_object (tree type)
{
- tree decl = build1 (NOP_EXPR, build_pointer_type (type), void_node);
+ tree decl = build1 (CONVERT_EXPR, build_pointer_type (type), void_node);
return cp_build_indirect_ref (decl, RO_NULL, tf_warning_or_error);
}
@@ -3028,7 +3028,7 @@ is_dummy_object (const_tree ob)
{
if (INDIRECT_REF_P (ob))
ob = TREE_OPERAND (ob, 0);
- return (TREE_CODE (ob) == NOP_EXPR
+ return (TREE_CODE (ob) == CONVERT_EXPR
&& TREE_OPERAND (ob, 0) == void_node);
}