diff options
author | Jason Merrill <jason@redhat.com> | 2023-03-15 16:33:37 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2023-03-15 18:29:39 -0400 |
commit | ea4dd8f512979db247c54d6b41377bb73699bcd7 (patch) | |
tree | a62e8a53f54ee4aaff82c96bc04637ab0c993e47 /gcc/cp | |
parent | 79aaba0a71f34ac1ac2c4cec907ff74740a6cf1a (diff) | |
download | gcc-ea4dd8f512979db247c54d6b41377bb73699bcd7.zip gcc-ea4dd8f512979db247c54d6b41377bb73699bcd7.tar.gz gcc-ea4dd8f512979db247c54d6b41377bb73699bcd7.tar.bz2 |
c++: co_await and initializer_list [PR103871]
When flatten_await_stmt processes the backing array for an initializer_list,
we call cp_build_modify_expr to initialize the promoted variable from the
TARGET_EXPR; that needs to be accepted.
PR c++/103871
PR c++/98056
gcc/cp/ChangeLog:
* typeck.cc (cp_build_modify_expr): Allow array initialization of
DECL_ARTIFICIAL variable.
gcc/testsuite/ChangeLog:
* g++.dg/coroutines/co-await-initlist1.C: New test.
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/typeck.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc index d5a3e50..afb9560 100644 --- a/gcc/cp/typeck.cc +++ b/gcc/cp/typeck.cc @@ -9630,6 +9630,8 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode, } /* Allow array assignment in compiler-generated code. */ + else if (DECL_P (lhs) && DECL_ARTIFICIAL (lhs)) + /* OK, used by coroutines (co-await-initlist1.C). */; else if (!current_function_decl || !DECL_DEFAULTED_FN (current_function_decl)) { |