aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cvt.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2017-06-09 20:40:50 -0400
committerJason Merrill <jason@gcc.gnu.org>2017-06-09 20:40:50 -0400
commite6d7d61861c8fa7207570abb6fc23c5a2921e4da (patch)
tree8d20815456dbc2d945ec18a4963a28ba3b75f5e9 /gcc/cp/cvt.c
parent8b8b203a26bdac3dede77e76d06e4e7084f79acc (diff)
downloadgcc-e6d7d61861c8fa7207570abb6fc23c5a2921e4da.zip
gcc-e6d7d61861c8fa7207570abb6fc23c5a2921e4da.tar.gz
gcc-e6d7d61861c8fa7207570abb6fc23c5a2921e4da.tar.bz2
Missing bits from N4268, constant evaluation for all non-type args.
* call.c (build_converted_constant_expr): Rename from build_integral_nontype_arg_conv, handle all types. * pt.c (convert_nontype_argument): In C++17 call it for all types. Move NOP stripping inside pointer case, don't strip ADDR_EXPR. * cvt.c (strip_fnptr_conv): Also strip conversions to the same type. From-SVN: r249089
Diffstat (limited to 'gcc/cp/cvt.c')
-rw-r--r--gcc/cp/cvt.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 3460e13..631ff49 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -2020,8 +2020,8 @@ fnptr_conv_p (tree to, tree from)
|| can_convert_tx_safety (t, f));
}
-/* Return FN with any NOP_EXPRs that represent function pointer
- conversions stripped. */
+/* Return FN with any NOP_EXPRs stripped that represent function pointer
+ conversions or conversions to the same type. */
tree
strip_fnptr_conv (tree fn)
@@ -2029,7 +2029,10 @@ strip_fnptr_conv (tree fn)
while (TREE_CODE (fn) == NOP_EXPR)
{
tree op = TREE_OPERAND (fn, 0);
- if (fnptr_conv_p (TREE_TYPE (fn), TREE_TYPE (op)))
+ tree ft = TREE_TYPE (fn);
+ tree ot = TREE_TYPE (op);
+ if (same_type_p (ft, ot)
+ || fnptr_conv_p (ft, ot))
fn = op;
else
break;