diff --git a/include/mp/proxy-types.h b/include/mp/proxy-types.h index e3b1b4b0..6e6d419a 100644 --- a/include/mp/proxy-types.h +++ b/include/mp/proxy-types.h @@ -963,6 +963,9 @@ LocalType BuildPrimitive(InvokeContext& invoke_context, TypeList, typename std::enable_if::value>::type* enable = nullptr) { + using E = std::make_unsigned_t>; + using T = std::make_unsigned_t; + static_assert(std::numeric_limits::max() >= std::numeric_limits::max(), "mismatched integral/enum types"); return static_cast(value); } diff --git a/test/mp/test/foo.capnp b/test/mp/test/foo.capnp index caa87ea8..df0d4361 100644 --- a/test/mp/test/foo.capnp +++ b/test/mp/test/foo.capnp @@ -27,6 +27,7 @@ interface FooInterface $Proxy.wrap("mp::test::FooImplementation") { passEmpty @12 (arg :FooEmpty) -> (result :FooEmpty); passMessage @13 (arg :FooMessage) -> (result :FooMessage); passMutable @14 (arg :FooMutable) -> (arg :FooMutable); + passEnum @15 (arg :Int32) -> (result :Int32); } interface FooCallback $Proxy.wrap("mp::test::FooCallback") { diff --git a/test/mp/test/foo.h b/test/mp/test/foo.h index a98fa19e..ceb8dcc2 100644 --- a/test/mp/test/foo.h +++ b/test/mp/test/foo.h @@ -21,6 +21,8 @@ struct FooStruct std::vector vbool; }; +enum class FooEnum : int { ONE = 1, TWO = 2, }; + struct FooCustom { std::string v1; @@ -72,6 +74,7 @@ class FooImplementation FooEmpty passEmpty(FooEmpty foo) { return foo; } FooMessage passMessage(FooMessage foo) { foo.message += " call"; return foo; } void passMutable(FooMutable& foo) { foo.message += " call"; } + FooEnum passEnum(FooEnum foo) { return foo; } std::shared_ptr m_callback; };