[llvm-bugs] [Bug 34982] New: [coroutines] assertion failure diagnosing bad coroutine await_suspend function

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 17 11:50:22 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=34982

            Bug ID: 34982
           Summary: [coroutines] assertion failure diagnosing bad
                    coroutine await_suspend function
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: gornishanov at gmail.com
          Reporter: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Testcase:


#include <experimental/coroutine>
namespace std { using namespace std::experimental; }

struct corotype {
  struct promise_type {
    std::suspend_always initial_suspend();
    std::suspend_always final_suspend();
  };
  bool await_ready() { return false; }
  void await_suspend();
};
static corotype f() {
}
void h();
corotype g() {
  auto a = f();
  while (co_await a) h();
}


Results in an assertion failure when diagnosing the bad await_suspend function:

<stdin>:17:10: error: too many arguments to function call, expected 0, have 1
clang-6.0:
/usr/local/google/home/richardsmith/build/llvm-2/src/tools/clang/lib/Frontend/TextDiagnostic.cpp:1015:
void highlightRange(const clang::CharSourceRange &, unsigned int,
clang::FileID, const (anonymous namespace)::SourceColumnMap &, std::string &,
const clang::SourceManager &, const clang::LangOptions &): Assertion
`StartColNo <= EndColNo && "Invalid range!"' failed.

-- 
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/20171017/742efc59/attachment.html>


More information about the llvm-bugs mailing list