Skip to content

Commit 6a2cd7e

Browse files
mohitmishra786nv-cmeerw
authored andcommitted
Add dependent co_yield cases to the GH546 test. [GH #546]
1 parent 57059a5 commit 6a2cd7e

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎tests/tests/changes/GH546.sft.cpp‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
// Without parentheses in the IL, the C++-generating back end dropped
66
// parentheses that are needed around a co_await or co_yield expression used
77
// as an operand, around a co_await operand with lower precedence, and around
8-
// a comma operand of co_yield.
8+
// a comma operand of co_yield. The dependent cases go through the IL (and
9+
// so need the fix) only when templates are kept in the IL
10+
// (ALL_TEMPLATE_INFO_IN_IL).
911

1012
namespace std {
1113
template<typename = void> struct coroutine_handle;
@@ -45,6 +47,7 @@ struct promise {
4547
void unhandled_exception();
4648
task get_return_object();
4749
awaiter<S> yield_value(S);
50+
awaiter<int> yield_value(int);
4851
};
4952
struct task { using promise_type = promise; };
5053

@@ -67,6 +70,8 @@ task yield_operand() {
6770
template<typename T>
6871
task dependent() {
6972
(co_yield T{}) = 1;
73+
int a = (co_yield 1) + 1;
74+
int b = (co_yield T{}.m) + 1;
7075
co_return;
7176
}
7277
template task dependent<S>();

0 commit comments

Comments
 (0)