diff options
author | Jason Merrill <jason@redhat.com> | 2022-06-23 00:24:22 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2022-06-23 11:07:21 -0400 |
commit | 124a9e08b7a83795bd4d09001955f0eef68ecd00 (patch) | |
tree | 95a4355dedee97c8354af62b54c689262cbf461f /libstdc++-v3/testsuite/experimental/filesystem | |
parent | 6e4d5300c1f62c3f0cd1bf859b0ee6bb4e31e434 (diff) | |
download | gcc-124a9e08b7a83795bd4d09001955f0eef68ecd00.zip gcc-124a9e08b7a83795bd4d09001955f0eef68ecd00.tar.gz gcc-124a9e08b7a83795bd4d09001955f0eef68ecd00.tar.bz2 |
c++: -Waddress and if constexpr [PR94554]
Like we avoid various warnings for seemingly tautological expressions when
substituting a template, we should avoid warning for the implicit conversion
to bool in an if statement. I considered also doing this for the conditions
in loop expressions, but that seems unnecessary, as a loop condition is
unlikely to be a constant.
The change to finish_if_stmt_cond isn't necessary since dependent_operand_p
looks through IMPLICIT_CONV_EXPR, but makes it more constent with
e.g. build_x_binary_op that determines the type of an expression and then
builds it using the original operands.
PR c++/94554
gcc/cp/ChangeLog:
* pt.cc (dependent_operand_p): Split out from...
(tsubst_copy_and_build): ...here.
(tsubst_expr) [IF_STMT]: Use it.
* semantics.cc (finish_if_stmt_cond): Keep the pre-conversion
condition in the template tree.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1z/constexpr-if38.C: New test.
Diffstat (limited to 'libstdc++-v3/testsuite/experimental/filesystem')
0 files changed, 0 insertions, 0 deletions