Commit a3259f63 authored by Jim Meyering's avatar Jim Meyering Committed by Alecs King

folly/ExceptionWrapper.h: avoid warning about typeid operand side effects

Summary:
* folly/ExceptionWrapper.h (class_name): Clang is not yet smart enough to
see that there is no harm in dereferencing an "item_" that we've just
verified is non-NULL.  Accommodate it, to avoid this:
./folly/ExceptionWrapper.h:199:30: error: expression with side effects will be evaluated despite being used as an operand to 'typeid' [-Werror,-Wpotentially-evaluated-expression]
return demangle(typeid(*item_));
^

Test Plan:
Run these commands and note there are fewer errors than before:
fbconfig --clang --with-project-version=clang:dev -r folly && fbmake dbgo

Reviewed By: mhorowitz@fb.com

Subscribers: trunkagent, yfeldblum, folly-diffs@

FB internal diff: D1848327

Tasks: 6244745

Signature: t1:1848327:1423869597:a58c9e9e3671befb78ae07fbd274a13d08ffb2a7

Blame Revision:
parent bb4612a0
......@@ -196,7 +196,8 @@ class exception_wrapper {
fbstring class_name() const {
if (item_) {
return demangle(typeid(*item_));
auto& i = *item_;
return demangle(typeid(i));
} else if (eptr_) {
return ename_;
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment