[all-commits] [llvm/llvm-project] 097208: [C++20] [Coroutines] Allow promise_type to not def...
Chuanqi Xu via All-commits
all-commits at lists.llvm.org
Thu Dec 23 21:39:45 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 097208dbf07786f3da84aec5b5f571c6e95a10e2
https://github.com/llvm/llvm-project/commit/097208dbf07786f3da84aec5b5f571c6e95a10e2
Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
Date: 2021-12-24 (Fri, 24 Dec 2021)
Changed paths:
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/lib/Sema/SemaCoroutine.cpp
M clang/test/SemaCXX/coroutines-exp-namespace.cpp
M clang/test/SemaCXX/coroutines.cpp
Log Message:
-----------
[C++20] [Coroutines] Allow promise_type to not define return_void or return_value
According to [dcl.fct.def.coroutine]p6, the promise_type is allowed to
not define return_void nor return_value:
> If searches for the names return_void and return_value in the scope
> of the promise type each find any declarations, the program is
> ill-formed.
> [Note 1: If return_void is found, flowing off the end of a coroutine is
> equivalent to a co_return with no operand. Otherwise, flowing off the
> end of a coroutine results in
> undefined behavior ([stmt.return.coroutine]). — end note]
So the program isn't ill-formed if the promise_type doesn't define
return_void nor return_value. It is just a potential UB. So the program
should be allowed to compile.
Reviewed By: urnathan
Differential Revision: https://reviews.llvm.org/D116204
More information about the All-commits
mailing list