fix EvictingCacheMap test bug found w/ -fsanitize-address-use-after-scope
authorLouis Brandy <ldbrandy@fb.com>
Sat, 8 Apr 2017 02:25:07 +0000 (19:25 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Sat, 8 Apr 2017 02:36:12 +0000 (19:36 -0700)
commit6ea7629b0091ebd0284106cdbfee36b80619b62f
tree0c6b5c5f3f223c9ac0d0d2010cba66f4ee3a89e4
parent9620aea0e79b41aa466ace8e322f9b7bb7005a4c
fix EvictingCacheMap test bug found w/ -fsanitize-address-use-after-scope

Summary: This test actually stores references to `sum` in objects it puts into the `EvictingCacheMap`. Those references get accessed in the destructor of the objects, which is the destructor of the `EvictingCacheMap`. That means the `sum` variable must outlive (and be declared -before-) the `EvictingCacheMap` it's testing.

Reviewed By: yfeldblum, meyering

Differential Revision: D4854619

fbshipit-source-id: b0a3109278f48d10b4cd0c52a12cb2064f4a00c5
folly/test/EvictingCacheMapTest.cpp