aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2009-08-14 01:21:01 +0000
committerGravatar kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2009-08-14 01:21:01 +0000
commit0bcfeb9dcd0885e37cda8b209209c18c9822a481 (patch)
treeee897b06bda896ae59bb01579a967d8415d271e7
parent8169c7fcde43861e4f55f5491f2b0c9ec367147b (diff)
Don't use RTTI in down_cast if GOOGLE_PROTOBUF_NO_RTTI is defined. Patch from Chris Masone (of Google).
-rw-r--r--src/google/protobuf/stubs/common.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h
index c789a776..3f002373 100644
--- a/src/google/protobuf/stubs/common.h
+++ b/src/google/protobuf/stubs/common.h
@@ -283,7 +283,9 @@ inline To down_cast(From* f) { // so we only accept pointers
implicit_cast<From*, To>(0);
}
+#if !defined(NDEBUG) && !defined(GOOGLE_PROTOBUF_NO_RTTI)
assert(f == NULL || dynamic_cast<To>(f) != NULL); // RTTI: debug mode only!
+#endif
return static_cast<To>(f);
}