summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/tests/InlineVector.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/cpp/src/tests/InlineVector.cpp b/cpp/src/tests/InlineVector.cpp
index bcd36e47b4..009f10af9d 100644
--- a/cpp/src/tests/InlineVector.cpp
+++ b/cpp/src/tests/InlineVector.cpp
@@ -30,6 +30,10 @@ using namespace std;
typedef InlineVector<int, 3> Vec;
bool isInline(const Vec& v) {
+ // If nothing, give it the benefit of the doubt;
+ // can't take address of nothing.
+ if (v.size() <= 0)
+ return true;
return (const char*)&v <= (const char*)(&v[0]) &&
(const char*)(&v[0]) < (const char*)&v+sizeof(v);
}