diff options
author | Marek Polacek <polacek@redhat.com> | 2023-01-31 14:36:30 -0500 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2023-02-01 08:30:55 -0500 |
commit | 5ce8961b46f050a96e8c542b34b1cf024ba95f1b (patch) | |
tree | d445ecf6bce4cdfd1958307a67dee6a739d8be8c /gcc/cp | |
parent | 1d77bfdf11fb9d7f9fcce7ed8817fc2877b3ded2 (diff) | |
download | gcc-5ce8961b46f050a96e8c542b34b1cf024ba95f1b.zip gcc-5ce8961b46f050a96e8c542b34b1cf024ba95f1b.tar.gz gcc-5ce8961b46f050a96e8c542b34b1cf024ba95f1b.tar.bz2 |
c++: ICE with -Wlogical-op [PR107755]
Here we crash in the middle end because warn_logical_operator calls
build_range_check which calls various fold_* functions and those
don't work too well when we're still processing template trees. For
instance here we crash because we're converting a RECORD_TYPE to bool.
At this point VIEW_CONVERT_EXPR<struct Foo>(b) hasn't yet been converted
to Foo::operator bool (&b).
I was excited to fix this with instantiation_dependent_expression_p
which can now be called from c-family/ as well, but the problem isn't
that the expression is dependent. So, p_t_d it is.
PR c++/107755
gcc/cp/ChangeLog:
* call.cc (build_new_op): Don't call warn_logical_operator when
processing a template.
gcc/testsuite/ChangeLog:
* g++.dg/warn/Wlogical-op-4.C: New test.
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/call.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc index 5715a7c..f7c5d9d 100644 --- a/gcc/cp/call.cc +++ b/gcc/cp/call.cc @@ -7335,7 +7335,7 @@ build_new_op (const op_location_t &loc, enum tree_code code, int flags, case TRUTH_ORIF_EXPR: case TRUTH_AND_EXPR: case TRUTH_OR_EXPR: - if (complain & tf_warning) + if ((complain & tf_warning) && !processing_template_decl) warn_logical_operator (loc, code, boolean_type_node, code_orig_arg1, arg1, code_orig_arg2, arg2); |