diff options
author | Marek Polacek <polacek@redhat.com> | 2024-08-15 11:53:10 -0400 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2024-08-19 13:36:06 -0400 |
commit | 52da8588fd06198edcda81d7acf83ec92ccb63ef (patch) | |
tree | b49424255cb227a565490a1fb1ed95d088bdfbb5 /libstdc++-v3/include/bits/regex.tcc | |
parent | af97b5eb023756c4a00c8c3327395f3d069d7e26 (diff) | |
download | gcc-releases/gcc-14.zip gcc-releases/gcc-14.tar.gz gcc-releases/gcc-14.tar.bz2 |
c++: fix ICE in convert_nontype_argument [PR116384]releases/gcc-14
Here we ICE since r14-8291 in C++11/C++14 modes. Fortunately
this is an easy one.
The important bit of r14-8291 is this:
@@ -20056,9 +20071,12 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
RETURN (retval);
}
if (IMPLICIT_CONV_EXPR_NONTYPE_ARG (t))
- /* We'll pass this to convert_nontype_argument again, we don't need
- to actually perform any conversion here. */
- RETURN (expr);
+ {
+ tree r = convert_nontype_argument (type, expr, complain);
+ if (r == NULL_TREE)
+ r = error_mark_node;
+ RETURN (r);
+ }
which obviously means that instead of returning right away we go
to convert_nontype_argument. When type is error_mark_node and we're
in C++17, in convert_nontype_argument we go down this path:
else if (INTEGRAL_OR_ENUMERATION_TYPE_P (type)
|| cxx_dialect >= cxx17)
{
expr = build_converted_constant_expr (type, expr, complain);
if (expr == error_mark_node)
return (complain & tf_error) ? NULL_TREE : error_mark_node;
// ...
}
but pre-C++17, we take a different route and end up crashing on
gcc_unreachable.
It would of course also work to check for error_mark_node early in
build_converted_constant_expr.
PR c++/116384
gcc/cp/ChangeLog:
* pt.cc (tsubst_expr) <case IMPLICIT_CONV_EXPR>: Bail if tsubst
returns error_mark_node.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/vt-116384.C: New test.
(cherry picked from commit 8191f15022b0ea44fcb549449b0458d07ae02e0a)
Diffstat (limited to 'libstdc++-v3/include/bits/regex.tcc')
0 files changed, 0 insertions, 0 deletions