diff options
author | Marek Polacek <polacek@redhat.com> | 2021-03-03 18:37:49 -0500 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2021-03-17 19:26:25 -0400 |
commit | 40465293cd780aa82dcae75dfcfb1449d8c0561e (patch) | |
tree | afe709bf81a04c581dad3b8c99bc3617bf8a93df /gcc/gimple-array-bounds.cc | |
parent | be246ac2d26e1cb072f205bf97d5eac150220f3f (diff) | |
download | gcc-40465293cd780aa82dcae75dfcfb1449d8c0561e.zip gcc-40465293cd780aa82dcae75dfcfb1449d8c0561e.tar.gz gcc-40465293cd780aa82dcae75dfcfb1449d8c0561e.tar.bz2 |
c++: ICE with real-to-int conversion in template [PR97973]
In this test we are building a call in a template, but since neither
the function nor any of its arguments are dependent, we go down the
normal path in finish_call_expr. convert_arguments sees that we're
binding a reference to int to double and therein convert_to_integer
creates a FIX_TRUNC_EXPR. Later, we call check_function_arguments
which folds the arguments, and, in a template, fold_for_warn calls
fold_non_dependent_expr. But tsubst_copy_and_build should not see
a FIX_TRUNC_EXPR (see the patch discussed in
<https://gcc.gnu.org/pipermail/gcc-patches/2018-March/496183.html>)
or we crash.
So let's not create a FIX_TRUNC_EXPR in a template in the first place
and instead use IMPLICIT_CONV_EXPR.
gcc/cp/ChangeLog:
PR c++/97973
* call.c (conv_unsafe_in_template_p): New.
(convert_like): Use it.
gcc/testsuite/ChangeLog:
PR c++/97973
* g++.dg/conversion/real-to-int1.C: New test.
Diffstat (limited to 'gcc/gimple-array-bounds.cc')
0 files changed, 0 insertions, 0 deletions