message: Fix unpack void type
The template unpack<void> is deduced as one argument instead of 0, and
results in below compile error:
```
error: variable or field ‘r’ declared void
error: return-statement with a value, in function returning ‘void’ [-fpermissive]
```
Fix this by checking void if `sizeof...(Args) == 1` and return void.
Also add a unit test case to make sure the code compiles.
Change-Id: I74cca180783645496863393be37215f1d6f4ca02
Signed-off-by: Lei YU <yulei.sh@bytedance.com>
diff --git a/test/message/read.cpp b/test/message/read.cpp
index c930372..9dbdbf1 100644
--- a/test/message/read.cpp
+++ b/test/message/read.cpp
@@ -715,4 +715,10 @@
EXPECT_EQ(tisb, std::make_tuple(ret_ti, ret_ts, ret_tb));
}
+TEST_F(ReadTest, UnpackVoid)
+{
+ new_message().unpack<>();
+ new_message().unpack<void>();
+}
+
} // namespace