diff options
author | Marek Polacek <polacek@redhat.com> | 2022-10-20 15:55:28 -0400 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2022-10-24 14:02:17 -0400 |
commit | f7d8ccfda2d5c90dac97b1a3ede8b10391a3cc40 (patch) | |
tree | eefd4617d0158fc6e2285e20aa769c84432df5e9 /gcc/tree-vectorizer.cc | |
parent | 65e3274e363cb2c6bfe6b5e648916eb7696f7e2f (diff) | |
download | gcc-f7d8ccfda2d5c90dac97b1a3ede8b10391a3cc40.zip gcc-f7d8ccfda2d5c90dac97b1a3ede8b10391a3cc40.tar.gz gcc-f7d8ccfda2d5c90dac97b1a3ede8b10391a3cc40.tar.bz2 |
c++: ICE with invalid structured bindings [PR107276]
This test ICEs in C++23 because we reach the new code in do_auto_deduction:
30468 if (cxx_dialect >= cxx23
30469 && context == adc_return_type
30470 && (!AUTO_IS_DECLTYPE (auto_node)
30471 || !unparenthesized_id_or_class_member_access_p (init))
30472 && (r = treat_lvalue_as_rvalue_p (maybe_undo_parenthesized_ref (init),
30473 /*return*/true)))
where 'init' is "VIEW_CONVERT_EXPR<<<< error >>>>(y)", and then the move
in treat_lvalue_as_rvalue_p returns error_mark_node whereupon
set_implicit_rvalue_p crashes.
I don't think such V_C_Es are useful so let's not create them. But that
won't fix the ICE so I'm checking the return value of move. A structured
bindings decl can have an error type, that is set in cp_finish_decomp:
8908 TREE_TYPE (first) = error_mark_node;
therefore I think treat_lvalue_as_rvalue_p just needs to cope.
PR c++/107276
gcc/cp/ChangeLog:
* typeck.cc (treat_lvalue_as_rvalue_p): Check the return value of move.
gcc/ChangeLog:
* tree.cc (maybe_wrap_with_location): Don't create a location wrapper
when the type is erroneous.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/decomp4.C: New test.
Diffstat (limited to 'gcc/tree-vectorizer.cc')
0 files changed, 0 insertions, 0 deletions