Index: lib/AST/MicrosoftMangle.cpp =================================================================== --- lib/AST/MicrosoftMangle.cpp +++ lib/AST/MicrosoftMangle.cpp @@ -1089,6 +1089,8 @@ case OO_Array_New: Out << "?_U"; break; // ::= ?_V # delete[] case OO_Array_Delete: Out << "?_V"; break; + // ::= ?__L # co_await + case OO_Coawait: Out << "?__L"; break; case OO_Conditional: { DiagnosticsEngine &Diags = Context.getDiags(); @@ -1098,14 +1100,6 @@ break; } - case OO_Coawait: { - DiagnosticsEngine &Diags = Context.getDiags(); - unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error, - "cannot mangle this operator co_await yet"); - Diags.Report(Loc, DiagID); - break; - } - case OO_None: case NUM_OVERLOADED_OPERATORS: llvm_unreachable("Not an overloaded operator"); Index: test/CodeGenCoroutines/microsoft-abi-operator-coawait.cpp =================================================================== --- /dev/null +++ test/CodeGenCoroutines/microsoft-abi-operator-coawait.cpp @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc18.0.0 -fcoroutines -emit-llvm %s -o - -std=c++14 -disable-llvm-passes | FileCheck %s +struct no_suspend { + bool await_ready() { return true; } + template 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); +} +