[PATCH] D59076: [coroutines][PR40978] Emit error for co_yield within catch block
Brian Gesiak via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 6 22:19:31 PST 2019
modocache created this revision.
modocache added reviewers: GorNishanov, tks2103, rsmith.
Herald added subscribers: jdoerfert, EricWF.
Herald added a project: clang.
As reported in https://bugs.llvm.org/show_bug.cgi?id=40978, it's an
error to use the `co_yield` or `co_await` keywords outside of a valid
"suspension context" as defined by [expr.await]p2 of
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/n4775.pdf.
Whether or not the current scope was in a function-try-block's
(https://en.cppreference.com/w/cpp/language/function-try-block) handler
could be determined using scope flag `Scope::FnTryCatchScope`. No
such flag existed for a simple C++ catch statement, so this commit adds
one.
Repository:
rC Clang
https://reviews.llvm.org/D59076
Files:
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Sema/Scope.h
lib/Parse/ParseStmt.cpp
lib/Sema/SemaCoroutine.cpp
test/SemaCXX/coroutines.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59076.189653.patch
Type: text/x-patch
Size: 6822 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190307/049a7d1b/attachment.bin>
More information about the cfe-commits
mailing list