diff --git a/cppwinrt/component_writers.h b/cppwinrt/component_writers.h index 45970c538..f562dabef 100644 --- a/cppwinrt/component_writers.h +++ b/cppwinrt/component_writers.h @@ -498,16 +498,18 @@ catch (...) { return winrt::to_hresult(); } { auto format = R"( % %::%(%) { - return @::implementation::%::%(%); + %@::implementation::%::%(%); } )"; + bool ignore_return = is_put_overload(method) || !signature.return_signature(); w.write(format, signature.return_signature(), type_name, method_name, bind(signature), + ignore_return ? "" : "return ", type_namespace, type_name, method_name, diff --git a/test/test_component/Class.h b/test/test_component/Class.h index 22867b57f..e3dada600 100644 --- a/test/test_component/Class.h +++ b/test/test_component/Class.h @@ -113,6 +113,22 @@ namespace winrt::test_component::implementation Windows::Foundation::IAsyncOperation RaiseDeferrableEventAsync(); static bool TestNoMakeDetection(); + + static int32_t StaticPropertyWithAsyncSetter() + { + return 0; + } + + static fire_and_forget StaticPropertyWithAsyncSetter(int32_t) + { + co_return; + } + + static fire_and_forget StaticMethodWithAsyncReturn() + { + co_return; + } + private: bool m_fail{}; diff --git a/test/test_component/test_component.idl b/test/test_component/test_component.idl index 31043c7e4..252e6d2f8 100644 --- a/test/test_component/test_component.idl +++ b/test/test_component/test_component.idl @@ -156,6 +156,8 @@ namespace test_component Windows.Foundation.IAsyncOperation RaiseDeferrableEventAsync(); static Boolean TestNoMakeDetection(); + static Int32 StaticPropertyWithAsyncSetter; + static void StaticMethodWithAsyncReturn(); } namespace Structs