[llvm-bugs] [Bug 43492] New: [coroutines] Incorrect warning about control reaching end of non-void generic coroutine lambda
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Sep 28 10:41:07 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=43492
Bug ID: 43492
Summary: [coroutines] Incorrect warning about control reaching
end of non-void generic coroutine lambda
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++2a
Assignee: unassignedclangbugs at nondot.org
Reporter: lewissbaker at gmail.com
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk
Clang trunk, 9.0 (but not 8.0 or earlier)
Compile options: -std=c++2a -fcoroutines-ts -stdlib=libc++ -Wreturn-type
See https://godbolt.org/z/pspDDo
Compiling the following code warns about control reaching the end of a non-void
lambda:
auto f = [](auto n) -> generator
{
co_yield n;
};
Results in the following warning:
<source>:43:5: warning: control reaches end of non-void lambda [-Wreturn-type]
};
Note that if the lambda is changed to be non-generic (ie. has argument 'int'
instead of 'auto') then the warning is not shown.
Execution running off the end of a coroutine should result in an implicit
'co_return;'.
It seems like the -Wreturn-type warning analyser is not aware of the fact that
this lambda is a coroutine and so follows different rules for determining
whether control runs off the end.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190928/81fd0edd/attachment-0001.html>
More information about the llvm-bugs
mailing list