aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenCoroutines/microsoft-abi-operator-coawait.cpp
blob: 1921c06e5af03ffc0e8e50970021511b5b38d3d4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc18.0.0 -fcoroutines-ts -emit-llvm %s -o - -std=c++14 -disable-llvm-passes | FileCheck %s
struct no_suspend {
  bool await_ready() { return true; }
  template <typename F> void await_suspend(F) {}
  void await_resume() {}
};

struct A {
  no_suspend operator co_await() { return {}; }
};

struct B {};

no_suspend operator co_await(B const&) { return {}; }

// CHECK-LABEL: f(
extern "C" void f() {
  A a;
  B b;
  // CHECK: call void @"\01??__LA@@QEAA?AUno_suspend@@XZ"(
  a.operator co_await();
  // CHECK-NEXT: call i8 @"\01??__L@YA?AUno_suspend@@AEBUB@@@Z"(
  operator co_await(b);
}