raw: Workaround compiler complaining about test
The compiler is smart enough to understand the input buffer is not big
enough to copy the Int. We want to test the runtime buffer size checking
though, so we need to make the memory buffer big enough but use a
reduced size range to prevent the compiler error.
Change-Id: If0e34a6ca9d11ac37f49afaa4201876db56e91d7
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/test/raw.cpp b/test/raw.cpp
index fa3c77e..770c7b4 100644
--- a/test/raw.cpp
+++ b/test/raw.cpp
@@ -115,7 +115,10 @@
TEST(ExtractRef, TooSmall)
{
- std::string_view s("a");
+ // Trick the compiler with a bigger buffer so it doesn't complain
+ std::array<char, sizeof(Int)> buf{};
+ buf[0] = 'a';
+ std::string_view s(buf.data(), 1);
EXPECT_THROW(extractRef<Int>(s), std::runtime_error);
EXPECT_EQ("a", s);
}