single_threaded_property<> doesn't work for enums?
jonwis opened this issue · comments
Jon Wiswall commented
wil/include/wil/cppwinrt_authoring.h
Lines 42 to 45 in 57a57cd
Trying to write this:
// IDL
enum FooKind { Kitten, Muffin };
runtimeclass Foo {
FooKind Kind;
}
// c++
struct Foo : FooT<Foo> {
single_threaded_property<FooKind> Kind;
}
Gets me:
Severity Code Description Project File Line Suppression State
Error C2664 'auto winrt::impl::detach_from<winrt::Test::FooKind>(T &&) noexcept': cannot convert argument 1 from 'const wil::single_threaded_property<winrt::Test::FooKind>' to 'T &&' winrt\Foo.h 368
Two potential fixes:
- Change the signature to
T operator()()
- Change the method to
auto operator()() { return static_cast<T>(*this); }